嵌套监听 方法可用
NoRootView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
if (scrollY > oldScrollY) {
MyLog.e("向下滑动");
}
if (scrollY < oldScrollY) {
MyLog.e("向上滑动");
}
if (scrollY == 0) {
MyLog.e("滑动到顶部");
}
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
MyLog.e("滑动到底部");
}
});
网友评论