滑动动态分页

实现 android.widget.AbsListView.OnScrollListener

 

主要代码

 

private int lastItemIndex; @Override public void onScroll(AbsListView v, int firstVisibleItem,int visibleItemCount, int totalItemCount) { lastItemIndex = firstVisibleItem + visibleItemCount - 1; } @Override public void onScrollStateChanged(AbsListView v, int state) { // adapter.count 为 android.widget.BaseAdapter 中的count属性 if (lastItemIndex == adapter.count && state == OnScrollListener.SCROLL_STATE_IDLE) { adapter.count += 10; adapter.notifyDataSetChanged(); } }  

 

你可能感兴趣的:(滑动动态分页)