从网上照搬了一个ListView分页加载的组件,代码很长,但是大家应该都明白,就是一个重写的ListView,添加了HeaderView和FooterView,然后根据刷新状态决定HeaderView和FooterView中组件的可见性。
FooterView这个整体是始终存在的,FooterView中有4个TextView分别显示不同的文字,在不同的状态时让其中的一个TextView 变为VISIBLE。
可是我在使用的时候出现了一个问题,每次滑动到底端的时候,此时已经可以看到FootView了(如果再往下滑就要开始加载更多了),如果这时候往上面滑动,就会一下子到达ListView的顶部,这是什么原因呢?
设置ListView数据源的代码如下:@Override
public void refresh(Object... param) {
// TODO Auto-generated method stub
int type=(Integer) param[0];
if(type==Constant.GET_GIFT_LIST_CONTENT){
Utility.closeProgressDialog();
listView.onLoadMoreComplete(3);
listView.onRefreshComplete();
List<GiftListItemBean> list=(List<GiftListItemBean>) param[1];
if(refresh_flag){     //如果是刷新操作,则将原数据清空
allList.clear();
refresh_flag=false;
}           
allList.addAll(list);
if(allList.size()>0){
adapter.notifyDataSetChanged();
}
}
}
listview分页上拉加载更多