不使用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")
}
})
评论