Here is my extracted code. I have tried some solution online but not working
private val scrollView = View.findViewById<NestedScrollView>(R.id.scroll)
scrollView.setOnScrollChangeListener { _, _, Y, _, oY ->
val scrollY = Y - oY
if (scrollY > 1) {
}else if (scrollY < -1) {
}
}
CodePudding user response:
Try this code
scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { view, _, YAxis, _, _ ->
if (view.getChildAt(0).bottom <= scrollView.height YAxis) {
//this detect when at the bottom
}else{
}
})