I have a UI design with CollapsingToolbarLayout, like following.
<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/detail_backdrop_height"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">
        <ImageView
            android:id="@+id/backdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            app:layout_collapseMode="parallax" />
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    android:theme="@style/ThemeOverlay.AppCompat.Light"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="24dp">
        <!-- Hiding unrelated code -->
        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/card_margin"
            android:padding="16dp">
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycler_movie_suggestion"
                    android:layout_width="match_parent"
                    android:layout_height="170dp"
                    android:fillViewport="true"
                    android:nestedScrollingEnabled="false"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>
My problem is, the scrolling is fine ONLY when I touch and scroll the area OUTSIDE the RecyclerView. If I try to scroll vertically inside the RecyclerView, the scrolling is "trapped" and ONLY the NestedScrollView is scrolling, the CollaspingToolbarLayout ISN'T collasping.
How can show all items in RecyclerView without scrolling? In RecyclerView use android:nestedSrollingEnabled="false" and use NestedScrollView as a parent Scroll View.
A android.view.ViewGroup that shows items in a horizontal scrolling list. NestedScrollView. 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.
setnestedscrollingenabled set it to false. try this one add property in recyclerview android:descendantFocusability="blocksDescendants" .
NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.
You need to disable nested scrolling programatically. It doesn't seem to work correctly if done in xml.
recyclerView.setNestedScrollingEnabled(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