Skip to content Skip to sidebar Skip to footer

Recyclerview Inside A Scrollview/nestedscrollview Does Not Scroll Properly

I have a layout which has a CardView and a FloatingActionButton associated with it. There is a list of replies below the CardView (which is a RecyclerView). Sometimes the CardViews

Solution 1:

When you have multiple scrolling Views in your layout (eg. RecyclerView + ScrollView) and when you scroll while in your recyclerView, the recyclerView scrolls with the parent Scrollview. this causes jitters in RecyclerView. You can avoid this jitter by the following.

You can add android:nestedScrollingEnabled="false" to your RecyclerView in XML or recyclerView.setNestedScrollingEnabled(false); to your RecyclerView in Java.

Solution 2:

If you want to support devices older than api 21 then you should use

ViewCompat.setNestedScrollingEnabled(mRecyclerView, false);

in your Activity/Fragment

Solution 3:

You have to do multiple tasks:

  1. put your recyclerview inside a android.support.v4.widget.NestedScrollView instead of normal ScrollView
  2. set your recyclerview android:nestedScrollingEnabled="true" in layout XML file
  3. to support devices older than API 21 then you should use ViewCompat.setNestedScrollingEnabled(mRecyclerView, false) in your code
  4. set your RecyclerView height to android:layout_height="wrap_content" (or width if it is horizontal!)

Solution 4:

Besides Setting the android:nestedScrollingEnabled="false" you need to make sure that the parent of the RecyclerView is a android.support.v4.widget.NestedScrollView

I had troubles that the RecyclerView did not measure properly (on big screens) when it was in a standard ScrollView

Solution 5:

if you want to scroll RecyclerView inside ScrollView and ScrollView prevents from scrolling RecyclerView (in API 16 this occurred) you should use android.support.v4.widget.NestedScrollView instead of ScrollView and also you must set nestedScrollView.setNestedScrollingEnabled(false); by this way you can prevent from scrolling nestedScrollView when you scroll RecyclerView. hope this help some one

Post a Comment for "Recyclerview Inside A Scrollview/nestedscrollview Does Not Scroll Properly"