android - 重新排序列表,如媒体播放器中的播放列表

标签 android list playlist

我有一个使用 SQLCursor 中的 ListView 显示的项目列表。 SQL 表包括(以及其他内容)一个 _id 字段和一个 order 字段。在到达 ListView 之前,我使用顺序字段对列表进行排序。

我需要的是一个类似于 MediaPlayer 在其播放 ListView 中的小部件。它允许您单击图标并拖动播放列表中的项目并将其放入新顺序。有了这种能力,我就可以检索新订单并使用新订单更新 SQL 表。但是,我没有运气找到任何线索来帮助我将该功能添加到我的程序中。

问题是我是否可以使用现有功能来帮助我,或者我是否需要手动对运动事件等进行编程,直到我获得几乎相同的功能。

最佳答案

However, I am not having any luck finding any clues to help me add that functionality into my program.

如果您想要音乐应用程序的功能(顺便说一下,它没有命名为“MediaPlayer”),go look at its source code .这是一个 StackOverflow question with answers它将您指向启用拖放的特定类 (TouchInterceptor)。

The question is whether I can use existing functions to help me, or do I need to manually program motion events and such until I get nearly the same functionality.

如果您正在寻找具有内置拖放功能的小部件,SDK 中没有。

关于android - 重新排序列表,如媒体播放器中的播放列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2564266/

相关文章:

android - 如何在 gradle 中获取当前 flavor

android - 在 XML 中将 ActionBar 背景颜色设置为 colorPrimary 以外的颜色

java - 如何将一些文件添加到播放列表中

android - Youtube API 返回未列出的视频

python - 在python中删除列表中的素数索引位置

javascript - Spotify:如何防止它记住听过超过一首歌曲?

java - Android Studio : App crashes when numbers are not inputted

android - 构建失败,因为在我的应用程序上添加了新库,导致依赖关系冲突

c# - 循环和更改列表 - 删除并不总是有效

python - 任意嵌套列表的过滤函数