在我的ExpandableListView
中,我要求默认情况下展开所有群组。
我使用CursorTreeAdapter
并覆盖changeCursor
以执行以下行为:
@Override
public void changeCursor(Cursor cursor) {
super.changeCursor(cursor);
int groupCount = getGroupCount();
for (int i = 0; i < groupCount; i++) {
if (!getListView().isGroupExpanded(i)) {
getListView().expandGroup(i, false);
}
}
}
整个for循环执行时间不到10毫秒,但如果我在调用changeCursor
时滚动,添加了新元素,则UI会冻结更长时间。
我尝试的另一个解决方案是在用户滚动到该组时(newGroupView
或bindGroupView
)扩展该组,但这会导致非常不稳定的滚动。
如何使用ListView
填充的标题Cursor
能够顺畅滚动?