Android - 拖放 - 列表重新排列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1940117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android - drag and drop - list rearrange
提问by wouter88
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 clocks app where you can rearrange the order of clocks?
就像在时钟应用程序中的 HTC Hero 上一样,您可以重新排列时钟的顺序?
采纳答案by Bo.
回答by ericharlow
回答by heycosmo
You can also try my recent implementation here:
你也可以在这里尝试我最近的实现:
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.
它在拖动时提供平滑滚动并支持任意高度的列表项。与 TouchInterceptor 相比,还删除了许多跳跃行为。
回答by CaseyB
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
它在platform/packages/apps/Music/src/com/android/music/TouchInterceptor.java
. 这是一个直接链接:https:
//android.googlesource.com/platform/packages/apps/Music/+/master/src/com/android/music/TouchInterceptor.java
回答by yanchenko
Hint: download the android sourcesand have a look how the Music app (packages\apps\Music
) implements this functionality.
提示:下载android 源代码并查看音乐应用程序 ( packages\apps\Music
)如何实现此功能。