0

I have the following layout with collapsible toolbar layout and recycler view. Somehow, it is not allowing recyclerview to overscroll. How can I achieve that? Thanks!

<com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar_layout"
        android:layout_width="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">


        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/ToolbarStyle"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize">
    </com.google.android.material.appbar.CollapsingToolbarLayout>

</com.google.android.material.appbar.AppBarLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <View
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"/>

</LinearLayout>
Kanika
  • 714
  • 8
  • 24

2 Answers2

0

try this, I'm currently using in an app

<com.google.android.material.appbar.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/AppTheme.AppBarOverlay">

    <com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="220dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize" />

    </com.google.android.material.appbar.CollapsingToolbarLayout>

</com.google.android.material.appbar.AppBarLayout>

I think you are forgeting just this part:

app:layout_scrollFlags="scroll|exitUntilCollapsed"
Azhagthott
  • 492
  • 5
  • 13
  • Hey Francisco, just tried it with the flags. Still the same result. It does not allow top overscroll. – Kanika Feb 20 '20 at 03:27
  • ok, I was checking the my ode and is very similar, the only difference is I'm using ConstraintLayout instead of LinearLayout, and check this View, you are using android:layout_height="match_parent" – Azhagthott Feb 20 '20 at 03:30
  • Is it allowing top overscroll for you? – Kanika Feb 20 '20 at 19:26
0

A large part of CoordinatorLayout 1.1.0 (which Material 1.1.0 is built off of) and RecyclerView 1.1.0 was in moving to the new nested scrolling APIs, which were specifically made to solve cases where overscroll would not be transferred between views correctly.

You should upgrade to Material 1.1.0 and RecyclerView 1.1.0.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443