问题描述
我觉得这是非常简单的 - 使用SimpleExpandableListAdapter时,基通过地图列表填充,和儿童受地图列表列表填充。当你构建适配器,你告诉它的关键与访问地图,像这样:
I think this is fairly straightforward -- when using SimpleExpandableListAdapter, groups are populated via a List of Maps, and children are populated by a List of Lists of Maps. When you construct the adapter, you tell it the key to access the Maps with, like so:
new SimpleExpandableListAdapter(
this,
createGroupList(), // returns List<Map>
R.layout.category_row,
new String[] { "Group Item" },
new int[] { R.id.row_name },
createChildList(), // returns List<List<Map>>
R.layout.feed_row,
new String[] { "Sub Item" },
new int[] { R.id.row_name }
);
我的问题是,说一个孩子,我可以存储在这个地图,以后访问它额外的数据?我说,我可以把在地图的附加键一个孩子,如类型 - >premade和访问后来通过getChild()SimpleExpandableListAdapter的方法
My question is, say for a child, can I store extra data in this map and access it later? Say, could I put an additional key in the Map for a child, such as "Type"->"Premade" and access it later via the getChild() method of SimpleExpandableListAdapter?
推荐答案
我觉得你可以。只是延长SimpleExpandableListAdapter并覆盖getView()。
I think you can. Just extend SimpleExpandableListAdapter and override getView().
这篇关于SimpleExpandableListAdapter使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!