1

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...

1
  • Hello Dima, I have exactly the same issue, took me several days before I have narrowed it down to this problem. Did you find a workaround for this? Jan 10, 2018 at 15:29

2 Answers 2

2

It seems this is a bug in NestedScrollView. You can workaround this by using the FixedAppBarLayoutBehaviour from here.

And add it to your AppBarLayout like this:

 <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_height="..."
        android:layout_width="..."
        app:layout_behavior="your.package.FixAppBarLayoutBehavior">
1
  • 1
    Today, I was solving this issue as well for whole evening. There was delay (strangely just on some phones) between UI started to register OnClick events on button after scrolling when NestedScrollView was involved. Workaround provided by @Petr does the trick for me. Dik za tip :).
    – bazinac
    Jan 11, 2018 at 23:14
0

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."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.