问题 如何将CursorAdapter绑定到ExpandableListView?


我现在可以绑定一个 的CursorAdapter 到了 ListView。并且ListView可以自动更新 数据库 被修改了。

对于数据库中的数据行有一个字段'type',它们可以是'Daily','Weekly','Monthly',。etc。我想在中显示行 ExpandableListView,以便每种类型的行可以组合在一起。我还希望ExpandableListView可以在修改数据库时自动更新。 我该如何结合 的CursorAdapter 和 ExpandableListView 一起?

我google了很多,但找不到解决方案,谢谢你的关注!


11705
2017-11-26 04:04


起源

是否有理由不使用专门为其设计的平台适配器之一 ExpandableListView? - Luksprog
不,我应该使用CursorTreeAdapter。但我现在才明白这一点! @Luksprog - ax003d


答案:


它被称为a CursorTreeAdapter

http://developer.android.com/reference/android/widget/CursorTreeAdapter.html

http://developer.android.com/reference/android/widget/SimpleCursorTreeAdapter.html


11
2017-11-26 05:28



谢谢!这就是我想要的! @芒果 - ax003d