Search code examples
androidandroid-coordinatorlayoutandroid-collapsingtoolbarlayoutandroid-design-libraryandroid-scroll

OnClick event does't called after scrolling with CollapsingToolbarLayout.


I've implemented parallax effect with CollapsingToolbarLayout and found an issue: When I click RecyclerView item immediately after the scrolling and parallax effect, the onClick event does't called, but onTouch event of RecyclerView is called.
If you wait few seconds (without clicking), it works well.

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbarLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:layout_scrollFlags="scroll">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:fitsSystemWindows="true"
                android:src="@drawable/img_stub"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"/>
        </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"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

The problem appears when i add app:layout_scrollFlags="scroll" to CollapsingToolbarLayout.
I think it can depends on scrim animation...


Solution

  • I've created an issue for this bug. https://issuetracker.google.com/issues/70883270

    This is thе answer of support library developers team: "Our engineering team has fixed this issue. It will be available in a future support lib release."