How to implement pagination of recyclerview that is within NestedScrollView?
if you are using Kotlin your code will be looks like
scroll?.viewTreeObserver?.addOnScrollChangedListener {
val view = scroll.getChildAt(scroll.childCount - 1)
Timber.d("Count==============${scroll.childCount}")
val diff = view.bottom - (scroll.height + scroll.scrollY)
Timber.d("diff==============$diff")
if (diff == 0) {
//your api call to fetch data
}
}
and last but the not the least set RecyclerView scrolling false
ViewCompat.setNestedScrollingEnabled(recyclerView, false)