【发布时间】:2017-05-19 09:52:41
【问题描述】:
我一直在使用 cursor 和 recyclerview。
我有一个查询的游标对象(从加载器传递)和一个标题字符串[]数组。
String headers[] = {"apples", "bananas"...};
现在我想将项目显示为
Apples
cursor row 1
cursor row 2
cursor row 3
Bananas
cursor row 4
cursor row 5
我不想使用 getItemCount() 方法进行调整。所以,计划传递一个适当长度的光标。
一种可能的方法是使用 MatrixCursor 和 MergeCursor 添加虚拟行,如下所述:Adding rows into Cursor manually。 这很好,但 MergeCursor 会一个接一个地对齐标题和光标数据。
想探索使用正确的标题和项目位置实现最终光标的方法。
【问题讨论】:
标签: android listview android-recyclerview android-cursor