Touch intercepted after fling

跟風遠走 提交于 2019-12-22 17:46:35

问题


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?



来源:https://stackoverflow.com/questions/33414912/touch-intercepted-after-fling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!