Swap the position of two objects


I need to swap the positions of two or more objects, just like Iphones swap the location of apps.

What MCU/Processor/Board and compiler are you using?

NXP RT1052

What LVGL version are you using?


What do you want to achieve?

When I’m holding down an object, I can drag it,, and when I drag it to another object, the positions of the two objects are automatically switched, just like the APP on the phone.

What have you tried so far?

When I presseed the object, I can drag it.But I don’t how to make it swap postion with another object.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Have you achieved what you wanted? I need something similar, did you solve your issue?
I want to be able position cards (like Material Design ones) and be able to switch positions by touching and dragging.