通过拖动重新排列ListView的元素 [英] Reorder elements of ListView by dragging
问题描述
我最近看到它在Android上做了很多事情:我可以将ListView中的一个项目拖动到列表中的另一个位置。但我似乎找不到任何示例代码。有没有人有一些他们不介意分享的示例代码。我一直在阅读 http://developer.android.com/guide/topics /ui/drag-drop.html ,但我没有太多进展。
I see it done a lot lately on android: I can drag an item in a listView to another position in the list. But I can't seem to find any example code. Does anyone have some example code they don't mind sharing. I have been reading http://developer.android.com/guide/topics/ui/drag-drop.html, but I am not making much progress.
并发症
所以我发现似乎是一个简单的方法来完成拖拽排序( http://ericharlow.blogspot.com/2010/10/experience-android-drag-and-drop-list.html )。但是我的孩子视图是可点击的,这似乎阻止父ListView看到我的拖动事件。任何想法如何解决这个问题?
So I find what seems to be a simple way to accomplish the drag-sort (http://ericharlow.blogspot.com/2010/10/experience-android-drag-and-drop-list.html). But my child views are clickable themselves, and that seem to block the parent ListView from seeing my drag events. Any ideas how to fix this?
推荐答案
bauerca listview是一种可能性... 这个SO post 处理这个事实有点复杂,并提供一个图书馆来整理事情; Git源代码可以在这里找到。祝你好运,对我来说有一些困难!
The bauerca listview is a possibility...this SO post deals with the fact that it is somewhat complicated, and offers a library to consolidate things; the Git source code can be found here. Good Luck, it worked for me with some difficulty!
这篇关于通过拖动重新排列ListView的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!