RecyclerView with CollapsingToolbarLayout scrolls strongly when tilted

I found strange behavior in RecyclerView with CollapsingToolbarLayout. When I view RecyclerView - it works fine. But when I try to drop it and stop it, fast enough - I see that the RecyclerView scrolls "inside of itself."

Bad behavior:

RecyclerView should not scroll before CollapsingToolbarLayout works completely, but it (in normal scrolling everything works fine, the problem only occurs when dropping).

enter image description here

My layout is as follows:

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="kg.nongrate.arseniii.collapsingtoolbarlayouttest.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="240dp"
                android:layout_marginTop="?attr/actionBarSize"
                android:background="@color/colorPrimary"
                android:text="1. Hello World!\n\n\n2. Hello World!\n\n\n3. Hello World!"
                android:textColor="@color/colorAccent"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.7"
                android:gravity="center" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimaryDark"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>


    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#0cc"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

Here are the sources and two videos that show what I mean: https: // NonGrate@bitbucket.org /NonGrate/collapsingtoolbarlayout-recyclerview-bug.git

+4

All Articles