android ListView监听滚动条滚动到底部时继续加载
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
}
});
补充:移动开发 , Android ,