一个ExpandableListView的多个布局

时间:2012-05-11 16:14:28

标签: android android-layout expandablelistview

我有ExpandableListView,我为自己的适配器扩展了BaseExpandableListAdapter。不过,我在分离器方面遇到了困难。我添加到我的ExpandableListView“分隔符”到某些位置的对象列表中,我需要使用不同的行布局在ExpandableListView中显示它们。现在的问题是,BaseExpandableListAdapter没有BaseAdapter所做的getViewTypeCount()和getItemViewType(int position)方法。有什么方法可以做到吗?

1 个答案:

答案 0 :(得分:3)

您可以通过为所需位置提供不同的Views来实现这些“分隔符”。为此,请使用:

getChildType()getChildTypeCount()(针对不同的孩子Views
getGroupType()getGroupTypeCount()(针对不同的群组Views

来自BaseExpandableListAdapter班。