Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 495
steve-gregory Avatar asked Oct 22 '11 20:10

steve-gregory


1 Answers

Just to confirm bos's answer in code:

    expandableList.setOnGroupExpandListener(new OnGroupExpandListener() {         int previousGroup = -1;          @Override         public void onGroupExpand(int groupPosition) {             if(groupPosition != previousGroup)                 expandableList.collapseGroup(previousGroup);             previousGroup = groupPosition;         }     }); 
like image 192
Blundell Avatar answered Oct 06 '22 13:10

Blundell