开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜