nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY > oldScrollY) {
Log.e("=====", "下滑");
}
if (scrollY < oldScrollY) {
Log.e("=====", "上滑");
}
if (scrollY == 0) {
Log.e("=====", "滑倒顶部");
}
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
Log.e("=====", "滑倒底部");
}
}
});