开发者

Use of 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 o开发者_Go百科f 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 } 
);

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?


I think you can. Just extend SimpleExpandableListAdapter and override getView().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜