0

I want to make an ExpandableListView which should always be showing its children elements even after clicking the header, and it should not collapse. How could I implement this concept?

ali_m
  • 71,714
  • 23
  • 223
  • 298
Abhimanyu
  • 1
  • 2
  • Why are you using `ExpandableListView` in this case? Just use a regular `ListView`, with different row layouts for the "children" to suggest that they are children (e.g., contents indented). – CommonsWare Jul 15 '14 at 11:57
  • for(int i=0;i – Abhimanyu Jul 15 '14 at 12:47
  • and in oncreatelistView.setOnGroupCollapseListener(new OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { // TODO Auto-generated method stub listView.expandGroup(groupPosition); } }); – Abhimanyu Jul 15 '14 at 12:48

1 Answers1

1

you can expand all groups one by one as below as mentioned in this post

ExpandableListView explst;

explst.expandGroup(0);
explst.expandGroup(1);

for disabling collapse you can define a OnGroupClickListener which returns true, like so: (as mentioned in this post)

explst.setOnGroupClickListener(new OnGroupClickListener() {
  @Override
  public boolean onGroupClick(ExpandableListView parent, View v,
                              int groupPosition, long id) { 
    return true; // This way the expander cannot be collapsed
  }
});
Community
  • 1
  • 1
Rajen Raiyarela
  • 5,526
  • 4
  • 21
  • 41