I have a vertical RecyclerView hosted in a CoordinatorLayout featuring a collapsing toolbar layout. The ViewHolder for this RecyclerView contains yet another RecyclerView wi
So while the above is still true, I found a workaround.
The workaround involves wrapping the ViewHolder RecyclerView in a RelativeLayout, and overlaying a transparent clickable view over it. In my case, I used a TextView.
Now while fixes the scrolling, there's still the issue of passing clicks to the right ViewHolder in the ViewHolderRecyclerView. To work around this second setback, I extended the GestureDetector.SimpleOnGestureListener class to contain a recyclerView. Then, I set a OnTouchListener on the wrapperTextView which then forwards the MotionEvent to the GestureDetector.SimpleOnGestureListener subclass.
The subclass finally interprets the motion event and passes it to the inner RecyclerView, which in turn from the coordinates of the click, figures out the child view clicked and calls performClick() on the child.
mRecyclerView.setNestedScrollingEnabled(false);
I had the same issue with RecyclerView and CollapsingToolbarLayout, where the RecyclerView was inside a NestedScrollView child layout.
For me the solution was to set programmatically:
mRecyclerView.setNestedScrollingEnabled(false);
Note: I tried setting this on the RecyclerView in XML but it did not work?
android:nestedScrollingEnabled="false"
Another trick to make the CollapsingToolbarLayout scroll is to set a 1000dp min height value to the child of the NestedScrollView
android:minHeight="1000dp"
why 1000dp? SupportDesignDemos example here: https://github.com/android/platform_development/blob/master/samples/SupportDesignDemos/res/layout/include_appbar_scrollview.xml
<android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.AppBarLayout>
<android.support.design.widget.CollapsingToolbarLayout >
<ImageView/>
<android.support.v7.widget.Toolbar/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout android:minHeight="1000dp">
<android.support.v7.widget.RecyclerView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>