ExpandableListView嵌套ExpandableListView做三级列表,二级列表中数据重复问题。
因为又嵌套了一个ExpandableListView,所以会写两个ExpandableAdapter,解决办法是设置父adapter的getChildrenCount()的返回值为1
@Override
public int getChildrenCount(int groupPosition) {
return 1;
}
原因是一级列表下的二三级是一个ExpandableListView,看图就能理解了,因此childrencount返回1。


本文探讨在使用ExpandableListView实现三级列表时遇到的数据重复问题。通过调整父Adapter的getChildrenCount()方法,将返回值设为1,解决了嵌套列表的显示异常。这一技巧适用于需要在一级列表下展示二三级列表的场景。
508

被折叠的 条评论
为什么被折叠?



