我正在尝试使用这个:lib当用户滑动时删除我的列表项。但我似乎不知道如何将我现有的 listView 转换为 DynamicListView。我已经阅读了给出的说明,它只是说要在 xml 布局中添加一些代码以将 listView 转换为 DynamicListView,但是我应该把代码放在哪里?在哪个xml文件中?我不知道。任何帮助将不胜感激。
这是维基中给出的内容:
To use the DynamicListView, include the following in your xml layout:
<com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
android:id="@+id/dynamiclistview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
最佳答案
看来您需要将当前列表设为
<com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
android:id="@+id/dynamiclistview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
并添加
描述的功能MyAdapter myAdapter = new MyAdapter();
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(myAdapter);
animationAdapter.setAbsListView(mListView);
mListView.setAdapter(animationAdapter);
创建您自己的适配器以插入您现有的 ListView 实现。所以我想知道,如果您有自己的适配器设置,您没有提供任何代码吗?因此,主要是您的 ListView 必须符合 xml“@+id/dynamiclistview”才能运行。如果您已经构建了一个适配器,我建议扩展那里的实现,并且只提供滑动和删除功能的方法。
编辑:
请注意这很重要 <com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
您已经实现并正确导入了库。 (有问题问)
关于android - 如何将我的 listView 转换为动态 ListView ?我指的是 http ://nhaarman. github.io/ListViewAnimations/#dynamiclistview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30902384/