解决NestedScrollView嵌套RecyclerView滚动监听问题

解决NestedScrollView嵌套RecyclerView滚动监听问题

Kornan
2020-08-14 / 0 评论 / 527 阅读 / 正在检测是否收录...

不使用recyclerview的监听,直接用NestedScrollView的监听

scrollView.setOnScrollChangeListener(
            NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
                if (scrollY > oldScrollY) {
                    Log.i(TAG, "Scroll DOWN")
                }
                if (scrollY < oldScrollY) {
                    Log.i(TAG, "Scroll UP")
                }
                if (scrollY == 0) {
                    Log.i(TAG, "TOP SCROLL")
                }
                if (scrollY == v.getChildAt(0).measuredHeight - v.measuredHeight) {
                    Log.i(TAG, "BOTTOM SCROLL")
                }
            })
0

评论

博主关闭了当前页面的评论