Michal
Michal

Reputation: 15669

Multiple layouts for one ExpandableListView

I have ExpandableListView and I extended BaseExpandableListAdapter for my own adapter. I am having hard times with separators, though. I added to my list of objects that go to the ExpandableListView "separators" to certain positions and I need to display them in the ExpandableListView using different row layouts. Now the problem is, that BaseExpandableListAdapter doesn't have methods getViewTypeCount() and getItemViewType(int position) that BaseAdapter does. Is there any way how to do it?

Upvotes: 1

Views: 1532

Answers (1)

user
user

Reputation: 87064

You could implement those "separators" by providing different Views for the position you want. To do this use the :

getChildType() and getChildTypeCount() (for different child Views)
getGroupType() and getGroupTypeCount() (for different group Views)

from the BaseExpandableListAdapter class.

Upvotes: 3

Related Questions