Pagination does not work for RecyclerView in NestedScrollView

How to implement recyclerview pagination within NestedScrollView ?

+5
source share
1 answer

Follow these steps:

1. Set the nested scroll to false to view the recycler.

 recyclerView.setNestedScrollingEnabled(false); 

2. Add a scroll list to a nested scrollview.

  mScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { View view = (View)mScrollView.getChildAt(mScrollView.getChildCount() - 1); int diff = (view.getBottom() - (mScrollView.getHeight() + mScrollView .getScrollY())); if (diff == 0) { // your pagination code } } }); 
+10
source

Source: https://habr.com/ru/post/1272444/


All Articles