Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
光标需要如何格式化,以便我可以正确显示类别及其子项。适配器将如何区分什么是类别和什么是子项?
初始 Cursor 只需要父项。在这里,我通常使用一个 Cursor 来给我不同的值。
您需要扩展 SimpleCursorTreeAdapter 并覆盖 getChildrenCursor()。在这里,我使用选定的不同值返回包含该类型所有行的 Cursor。
简单地说,您需要一个用于父值的游标和一个用于每个子值的游标。大多数情况下,子光标与所选父光标的 where 子句相同。