Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi level view: expandablelistview

I am trying to write multi level tree. I did look at expandablelistview, but it only supports two levels. I did look at other questions(SO) & posts and the most promising post i have found is http://mylifewithandroid.blogspot.com/2011/02/3-level-expandable-lists.html

I understand that i will have to write something custom to handle multiple level tree. What is the best recommended approach to take? Can i add an exapandablelistview as a child to an exapanablelistview??

Thanks

like image 676
jsp Avatar asked Jul 30 '26 04:07

jsp


1 Answers

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 a BaseExpandableListAdapter instance to the convertView, and return it.

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

like image 159
rekaszeru Avatar answered Jul 31 '26 19:07

rekaszeru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!