listView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 当不滚动时
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
//判断是否滚动到底部
if (view.getLastVisiblePosition() == view.getCount() - 1) {
adapter.count += 10;
adapter.notifyDataSetChanged();
int currentPage=adapter.count/10;
Toast.makeText(getApplicationContext(), "第"+currentPage+"页", Toast.LENGTH_LONG).show();
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
});
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 当不滚动时
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
//判断是否滚动到底部
if (view.getLastVisiblePosition() == view.getCount() - 1) {
adapter.count += 10;
adapter.notifyDataSetChanged();
int currentPage=adapter.count/10;
Toast.makeText(getApplicationContext(), "第"+currentPage+"页", Toast.LENGTH_LONG).show();
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
});