两种方法 或者根本上一种:
就是当达到一页的最后一个时 在getView() 判断 if position
is >=
the size of ListAdapter.getCount()
.
然后就显示另一页
其实也可以
public static final int SCROLLING_OFFSET = 5;
// ...
private final ArrayList<T> items = new ArrayList<T>();
// ...
if (SCROLLING_OFFSET == items.size() - position) {
if (hasNextPage()) {
addNextPage();
}
}
private boolean hasNextPage() {
// basically calculates whether the last 2 pages contained the same # of items
}
private void addNextPage() {
// show spinner
// fetch next page in a background thread
// add to items
notifyDataSetChanged();
}