Keep Group Expanded Status when change data expandable list view

人走茶凉 提交于 2020-01-16 05:42:08

问题


When user click the group row, the children list is expanded and show. When i add any group item to Arraylist and call method notifyDataSetChanged(); Group Expanded Status wrong .. how to do fix

Example: Current group position 1 (parent 2) is expanded.. When i add group parent 0 to first and call notifyDataSetChanged(); . parent 2 is collapse and parent 1 is expanded. How to keep parent 2 expaded

Sorry my english not good.


回答1:


when you want add parent and of its children just before,

1.just take all current parents and their children in one temporarily list

2.clear current filled list.

3.add new parent and their children to list(that we clear).

4.now, add temporarily list to our current list(in which we add, new parent and their children)

5.now use new filled list to you expandable list adapter

6.clear your temporarily list.



来源:https://stackoverflow.com/questions/29738932/keep-group-expanded-status-when-change-data-expandable-list-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!