Android - drag and drop - list rearrange

前端 未结 5 682
别跟我提以往
别跟我提以往 2020-12-02 06:50

How can I create a list where I can rearrange list items with dragging list rows to another row and so on (to change to order)?

Just like on the HTC Hero in the cloc

相关标签:
5条回答
  • 2020-12-02 07:14

    Hint: download the android sources and have a look how the Music app (packages\apps\Music) implements this functionality.

    0 讨论(0)
  • 2020-12-02 07:15

    Pay special attention to this one

    com.android.music.TouchInterceptor

    0 讨论(0)
  • 2020-12-02 07:19

    Even though this question is already answered. I struggled using the music app as an example, so I created a simple Drag and Drop List project to help others that can be found here

    0 讨论(0)
  • 2020-12-02 07:26

    It's in platform/packages/apps/Music/src/com/android/music/TouchInterceptor.java. Here's a direct link:
    https://android.googlesource.com/platform/packages/apps/Music/+/master/src/com/android/music/TouchInterceptor.java

    0 讨论(0)
  • 2020-12-02 07:31

    You can also try my recent implementation here:

    • https://github.com/bauerca/drag-sort-listview

    It gives smooth scrolling while dragging and supports list items with arbitrary heights. Lots of jumpy behavior has also been removed as compared to the TouchInterceptor.

    0 讨论(0)
提交回复
热议问题