Recyclerview inside ScrollView not scrolling smoothly
Try doing:
RecyclerView v = (RecyclerView) findViewById(...);v.setNestedScrollingEnabled(false);
As an alternative, you can modify your layout using the support design library. I guess your current layout is something like:
<ScrollView > <LinearLayout > <View > <!-- upper content --> <RecyclerView > <!-- with custom layoutmanager --> </LinearLayout ></ScrollView >
You can modify that to:
<CoordinatorLayout > <AppBarLayout > <CollapsingToolbarLayout > <!-- with your content, and layout_scrollFlags="scroll" --> </CollapsingToolbarLayout > </AppBarLayout > <RecyclerView > <!-- with standard layoutManager --></CoordinatorLayout >
However this is a longer road to take, and if you are OK with the custom linear layout manager, then just disable nested scrolling on the recycler view.
Edit (4/3/2016)
The v 23.2
release of the support libraries now includes a factory “wrap content” feature in all default LayoutManager
s. I didn’t test it, but you should probably prefer it to that library you were using.
<ScrollView > <LinearLayout > <View > <!-- upper content --> <RecyclerView > <!-- with wrap_content --> </LinearLayout ></ScrollView >
I only needed to use this:
mMyRecyclerView.setNestedScrollingEnabled(false);
in my onCreateView()
method.
Thanks a lot!
You can use this way either :
Add this line to your recyclerView xml file :
android:nestedScrollingEnabled="false"
Or in java code :
RecyclerView.setNestedScrollingEnabled(false);
Hope this helped .