android - DynamicListView 拖放 onDrop?

标签 android callback drag-and-drop

我正在试用 https://github.com/nhaarman/ListViewAnimations在我的程序中使用的库。特别是拖放支持。

虽然我设法将应用程序调整为 DynamicListView(这并不难,感谢作者提供的强大库),但我似乎无法理解如何将更改应用于数据背后的持久存储列表 - 例如,sqlite 数据库数据。

DynamicListView 或 ArrayAdapter 中不应该有一个回调通知应用程序拖放结束吗?

最佳答案

回调会很好,但它似乎没有内置到库中。

查看源代码,您可以看到交换发生在 swapElements() 中。 DynamicListView.java的功能.您可以看到它检查提供给列表的适配器是否实现了 Swappable 接口(interface),如果是,则调用其 swapItems() 函数。

因此,您只需在适配器中实现该接口(interface),然后将其提供给 DynamicListView。

关于android - DynamicListView 拖放 onDrop?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20627706/

相关文章:

Qt:如何使用自定义模型实现简单的内部拖放以重新排序 QListView 中的项目

drag-and-drop - 使用Ember.js拖放

android - 如何使用 adb pull 命令?

android - 来自 adb : Invalid argument(s): The source must not be null Error launching application on device 的 Flutter 意外失败

android - 将父线性布局的宽度设置为屏幕的百分比

node.js - Fs.writeFile 回调未调用

PHP 回调函数不适用于对象函数

Android SQLite查询哪里哪里

javascript - 在 forio/contour 中执行 render 函数后添加回调

drag-and-drop - Mojave - 如果写入的项目多于拖动的行,则从 NSTableView 拖放会失败