你可以尝试自己实现它。它很容易:
我是怎么做的:
1)设置你的列表视图的onScrollStateChange:
@Override
public void onScrollStateChanged(AbsListView listView, int scrollState) {
if (scrollState == SCROLL_STATE_IDLE) {
if (listView.getLastVisiblePosition() >= listView.getCount()-1) {
//scroll reached the end, trigger the method to load more itens!
}
}
}
2)在您的基本适配器中:
private static final int TYPE_VIEW_COUNT = 2;
private static final int TYPE_VIEW_CONTENT = 0;
private static final int TYPE_VIEW_LOADING = 1;
@Override
public int getItemViewType(int position) {
if (position == (getCount()-1)) {
return TYPE_VIEW_LOADING;
} else {
return TYPE_VIEW_CONTENT;
}
}
@Override
public int getViewTypeCount() {
return TYPE_VIEW_COUNT;
}
@Override
public int getCount() {
//return list size + 1;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
switch (getItemViewType(position)) {
case TYPE_VIEW_CONTENT:
//load your content view (using convertView and then...)
break;
case TYPE_VIEW_LOADING:
//load your loading view (indeterminate progressbar)
break;
}
return view;
}