Abhimanyu
Abhimanyu

Reputation: 1

How to make an ExpandableListView in Android always show child items

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?

Upvotes: 0

Views: 983

Answers (1)

Rajen Raiyarela
Rajen Raiyarela

Reputation: 5634

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
  }
});

Upvotes: 1

Related Questions