我想更新我的列表,当我向下滚动列表时,我处于最后一个位置,然后向下滚动,我这样做了,但效果不佳
mConnectionList.setOnScrollListener(new AbsListView.OnScrollListener() {
private int visibleThreshold = 5;
private int currentPage = 0;
private int previousTotal = 0;
private boolean loading = true;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if(totalItemCount == previousTotal && currentPage == totalItemCount){
getConnections();
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
});
答案 0 :(得分:0)
可以完成此操作的常用类是PagedListAdapter类。它允许您描述的行为(称为分页),但是您需要使用recyclerview。
请参阅: https://developer.android.com/reference/android/arch/paging/PagedListAdapter