0

My problem is...
I use Expandable list view in my activity. When the activity created it shows all the child group is collapsed. I would like to expand all children while the expandable list view is populated.
like

for that, I used below code in getGroupView() method adapter class

ExpandableListView eLV = (ExpandableListView) parent         
eLV.expandGroup(groupPosition,true);

now the groups are expanded but it can not allow me to collapse by clicking on the group header.

Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
div patel
  • 213
  • 1
  • 2
  • 5

1 Answers1

0

Simply add groupClickListener and return true for disabling collapse the child list. Add this code to your activity.

yourExpandableList.setOnGroupClickListener(new OnGroupClickListener() {
  @Override
  public boolean onGroupClick(ExpandableListView parent, View v,
                              int groupPosition, long id) { 
    return true; // This way the expander cannot be collapsed
  }
});
Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50