Is there an easy way to drag items around in a ListView to change their order?
Let's say I have a ListView of items:
- Cat
- Dog
- Mouse
And these are bound to the ListView via an adapter to a database.
What I want to be able to do is to be able to re-order the list view,. For example I want to somehow drag "Mouse" up to the top of the list above "Cat". Once I have an order set, I then want to "save" the list and its order back to the database.
Is there any way to do this? Has someone made such a custom ListView that I could use? The only alternative I can think of is to long press on a list view item and have开发者_StackOverflow社区 a "Move up by one", "Move to top", etc. context menu that moves items around in the list.
Android's music application does that with the playlist. Check it's source code here.
精彩评论