Reputation: 111
Im using nhaarman's ListviewAnimation library https://github.com/nhaarman/ListViewAnimations which works great.
Though I have difficulty tweaking one of his options, which is ExpandableListview. I want to tweak it so that only 1 child view (content view)is visible at a time. So when expanding a parent view (title view) item it should close the previous one. I can't seem to update (notify) my adapter when a child view is visible (is expanded). I have a custom adapter which extends ExpandableListItemAdapter.
This is the class here .
Each item is set with the TitleViewOnClickListener, which handles the expanding ad collapsing of the content view.
Now I would like to collapse all visible child views and keep the selected open. Could anyone here help me or guide me in the right direction?
Next to that I can't seem to get an onlistitem click.
Thank you in advance
Upvotes: 2
Views: 638
Reputation: 301
You can use:
@Override
public int getChildrenCount(final int groupPosition) {
return 1;
}
Upvotes: 2
Reputation: 100358
I've added a setLimit(int)
function to the ExpandableListItemAdapter
class. When the (limit+1)
th item is expanded, the first expanded item will collapse.
In your case, you could call setLimit(1)
.
Upvotes: 4