Touch intercepted after fling

2019-05-23 08:04发布

问题:

Recently I am experiencing some issues with my scrollview. Touch events don't reach elements inside a scrollview after a fling has happened. After a fling has occurred I first need to tap the view once again, after that the normal behaviour is restored. I already tried lot's of workarounds like:

  • Manually fire a motion event (up / down) after the fling. This works but has some serious issues, I don't have to explain why I guess since this is just the same as touching the view again but that at a certain x+y.
  • Intercept touch events and always pass them to the underlying views.

But all this is quite a hassle and this seems like unwanted behaviour in the first place no?

Seems like the scrollview intercepts everything after the onfling has occured untill a new normal(no fling) up & down touch.

 <android.support.v4.widget.NestedScrollView
    android:id="@+id/fsv_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/white">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:src="@drawable/marker"
        android:padding="@dimen/spacing_small"/>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_jobs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        />

</LinearLayout>

</android.support.v4.widget.NestedScrollView>

回答1:

You have a scrolling view (NestedScrollView) containing another scrolling view (RecyclerView). Sounds like trouble to me.

Why do you need such a layout?