阅读后发现 notifyGroupRangeInserted 库中提供的插入多个分组数据时,是否定位错误
在for循环中使用hasHeader(i) ,hasFooter ,getChildrenCount目前的i位置错误,根据i无法确定对应分组数据问题
以下是库中方法
` public void notifyGroupRangeInserted(int groupPosition, int count) {
ArrayList list = new ArrayList<>();
for (int i = 0; i < count; i++) {
GroupStructure structure = new GroupStructure(hasHeader(i),
hasFooter(i), getChildrenCount(i));
list.add(structure);
}
if (groupPosition < mStructures.size()) {
mStructures.addAll(groupPosition, list);
} else {
mStructures.addAll(list);
groupPosition = mStructures.size() - list.size();
}
int index = countGroupRangeItem(0, groupPosition);
int itemCount = countGroupRangeItem(groupPosition, count);
if (itemCount > 0) {
notifyItemRangeInserted(index, itemCount);
}
}`
阅读后发现 notifyGroupRangeInserted 库中提供的插入多个分组数据时,是否定位错误 在for循环中使用hasHeader(i) ,hasFooter ,getChildrenCount目前的i位置错误,根据i无法确定对应分组数据问题 以下是库中方法 ` public void notifyGroupRangeInserted(int groupPosition, int count) { ArrayList list = new ArrayList<>();
for (int i = 0; i < count; i++) {
GroupStructure structure = new GroupStructure(hasHeader(i),
hasFooter(i), getChildrenCount(i));
list.add(structure);
}