开发者

How can I create a 2 level or 3 level expandable ListView?

开发者 https://www.devze.com 2023-02-24 23:12 出处:网络
I am planning to create an expandable Listview that has more than 2 levels. How can I do this?开发者_如何学PythonYou can achieve an n-level ExpandableListView, if you use it with your custom BaseExpan

I am planning to create an expandable Listview that has more than 2 levels. How can I do this?开发者_如何学Python


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消