Search code examples
androidexpandablelistviewexpandablelistadapter

Show only one child of expandable list at a time


Is it possible to only expand one child of an ExpandableListView at a time, thus opening a second child would close the previously opened child?


Solution

  • I'm not aware of any automatic methods for this, but you can implement ExpandableListView.OnGroupClickListener, in where you run collapseGroup() for all list groups except the one being clicked. This will do what you want.