Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExpandableListView Group View Expand Default

I have develop ExpandableListView perfectly.

In My ExpandableListView five groups are there. load first time then collapse all five group. it is default.

now my question is load first time expandablelistview at that time 2 groups are expand and other 3 groups are collapse.

so please guide me how to do?

like image 501
Nikhil Avatar asked May 21 '11 10:05

Nikhil


2 Answers

Now I got solution and it will work perfectly.. Please use this..

ExpandableListView Exlist;  Exlist.expandGroup(0); Exlist.expandGroup(1); 
like image 160
Nikhil Avatar answered Oct 01 '22 03:10

Nikhil


I built this snippet based off Nikhil's answer. Thought others might find it useful as well. Only works if you are using BaseExpandableListAdapter. elv

ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv_main); elv.setAdapter(adapter); for(int i=0; i < adapter.getGroupCount(); i++)     elv.expandGroup(i); 
like image 20
bhekman Avatar answered Oct 01 '22 04:10

bhekman