damienix
damienix

Reputation: 6763

Initially expanded group in ExpandableListView

I want my group to be expanded at first time. Then it should behave as usual (collapse/expand after click on indicator)

I cannot found any working solution for this problem.

Upvotes: 0

Views: 720

Answers (2)

sleidig
sleidig

Reputation: 1402

Loop through all groups and use expandGroup() of your ExpandableListView:

ExpandableListView expView = (ExpandableListView) findViewById(R.id.expView);
ExpandableRecAdapter expAdapter = new ExpandableRecAdapter(this, expHeaders, expItems);
expView.setAdapter(expAdapter); 

for (int i = 0; i < expAdapter.getGroupCount(); i++)
    expView.expandGroup(i);

(or see other StackOverflow questions like this one: ExpandableListview How to Auto groupExpand - Android)

Upvotes: 3

marmor
marmor

Reputation: 28239

Have you tried to API call exapndGroup?

http://developer.android.com/reference/android/widget/ExpandableListView.html#expandGroup(int)

Upvotes: 1

Related Questions