2

I am planning to create an expandable Listview that has more than 2 levels. How can I do this?

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
James
  • 13,891
  • 26
  • 68
  • 93

1 Answers1

1

You can achieve an n-level ExpandableListView, if you use it with your custom BaseExpandableListAdapter.

In this extended adapter, you override the

public View getGroupView(int groupPosition, boolean isExpanded, 
    View convertView, ViewGroup parent)

method, assign an ExpandableListView instance to the convertView, and return it.

If you have overriden all the necessary methods in your adapter, this should work.

In this thread you can find a working sample of ExpandableListView using BaseExpandableListAdapter. If you modify its getGroupView method to return an other ExpandableListView instance, you'll have a multilevel listview.

Community
  • 1
  • 1
rekaszeru
  • 19,130
  • 7
  • 59
  • 73