我需要进行分页,并且每次向下滚动时都使用nestedscrollview
,只能向下滚动一次,只能向下滚动一次,只能向下滚动一次,只能向上滚动一次
nestedScrollView=(NestedScrollView)findViewById(R.id.scroll);
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY > oldScrollY) {
pageNumber=pageNumber+1;
getData(pageNumber);
}
if (scrollY < oldScrollY) {
getData(pageNumber);
}
if (scrollY == 0) {
getData(pageNumber);
}
if (scrollY == ( v.getMeasuredHeight() - v.getChildAt(0).getMeasuredHeight() )) {
pageNumber=pageNumber+1;
getData(pageNumber);
}
}
});