逃跑后触摸被拦截 [英] Touch intercepted after fling

查看:112
本文介绍了逃跑后触摸被拦截的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我的滚动视图遇到了一些问题.猛击发生后,触摸事件不会到达滚动视图中的元素.发生掠夺事件后,我首先需要再次点击视图,然后恢复正常行为.我已经尝试了很多解决方法,例如:

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:

  • 在猛扑后手动触发运动事件(向上/向下).这行得通,但是有一些严重的问题,我不必解释为什么会这样,因为这与再次触摸视图相同,但是在特定的x + y位置.
  • 拦截触摸事件,并始终将其传递给基础视图.

但这一切都是很麻烦的,一开始这似乎是不想要的行为,不是吗?

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

似乎onfling发生后,scrollview会拦截所有内容,直到出现新的法线(无猛冲)为止.向下触摸.

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>

推荐答案

您有一个滚动视图(NestedScrollView),其中包含另一个滚动视图(RecyclerView). 对我来说听起来很麻烦.

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

为什么需要这样的布局?

Why do you need such a layout?

这篇关于逃跑后触摸被拦截的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆