ExpandListView预加载问题

1.在第一次加载后会缓存数据,在相关网络请求加载的过程中会预先显示前面缓存的数据,想要阻止该现象可以将要显示的数据设置为空。

expandableListView.setOnGroupClickListener(newExpandableListView.OnGroupClickListener() {

@Override

public booleanonGroupClick(ExpandableListView expandableListView,View view, inti, longl) {

//                判断父列表是否展开

if(expandableListView.isGroupExpanded(i))

{

expandableListView.expandGroup(i);

}else{

item_lists.set(i,null);      //先将需要显示的子列表设为空

//                    从网络端获取数据

System.out.println("group:"+group_list.get(i)+"  I: "+i);

getData(group_list.get(i),i);

}

//                Toast.makeText(getActivity(), "group=" + i +"child="+item_lists.size(), Toast.LENGTH_SHORT).show();

return false;

}

});

你可能感兴趣的:(ExpandListView预加载问题)