给listview设置一个OnScrollListener就可
ListView.OnScrollListener scrollListener = new ListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
System.out.println("刷新完毕 ");
pullRV.endPulling();
break;
case OnScrollListener.SCROLL_STATE_FLING:
System.out.println("挑划产生刷新");
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
System.out.println("拖动产生刷新 ");
View cld = listview.getChildAt();
if (cld.getTop() == ) {
}
break;
default:break;
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
System.out.println(String.format("first = %d,count = %d,total = %d", firstVisibleItem,visibleItemCount,totalItemCount));
if (firstVisibleItem == ) {
System.out.println("onScroll滑到顶部");
}
if (firstVisibleItem + visibleItemCount == totalItemCount) {
System.out.println("onScroll滑到底部");
}
}
};
listview.setOnScrollListener(scrollListener);