I have a layout like that:
<NestedScrollView> <RecyclerView> // vertical recycler view <RecyclerView/> // horizontal recycler view <RecyclerView/> <RecyclerView/> ... <RecyclerView> </NestedScrollView>
The result looks like Google play store:
And I disabled NestedScrolling in horizontal Recycler
view:
horizontalRecyclerView.setHasFixedSize(true); horizontalRecyclerView.setNestedScrollingEnabled(false);
The vertical recyclerview
does not scroll fling, whenever ACTION_UP
happen, the vertical recyclerview
also stop scrolling.
How can I nest vertical recyclerview
inside nestedscrollview
, and horizontal recyclerview
inside vertical recyclerview
like Playstore and keep the scroll smooth.
Using custom nested scroll view of @vrund purohit (code below), and disabled nestedscroll both vertical and horizontal recyclerview:
verticalRecyclerView.setNestedScrollingEnabled(false); ... add each horizontal recyclerviews: horizontalRecyclerView.setNestedScrollingEnabled(false);
The problem can be solved by moving the SliverAppBar into the CustomScrollView and not use the NestedScrollView at all.
Nested scrolling is enabled by default. Show activity on this post. NestedScrollView is just like ScrollView, but in NestedScrollView we can put other scrolling views as child of it, e.g. RecyclerView. But if we put RecyclerView inside NestedScrollView, RecyclerView's smooth scrolling is disturbed.
Also, if you are using a recycler view inside the scroll view, make sure to set nested scrolling to false. Show activity on this post. Use a library as said by other comments in here. Also make sure you do not have Recyclerviews nested within a Scrollview.
NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. It is enabled by default. NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.
Use below code for smooth scroll:
ViewCompat.setNestedScrollingEnabled(recyclerView, false);
Add this in your RecyclerView xml:
android:nestedScrollingEnabled="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With