首页 文章

投掷后触摸拦截

提问于
浏览
2

最近我的卷轴视图遇到了一些问题 . 在发生投掷后,触摸事件不会到达滚动视图内的元素 . 在发生抛弃之后,我首先需要再次点击视图,之后恢复正常行为 . 我已经尝试了很多类似的解决方法:

  • 在投掷后手动触发一个动作事件(向上/向下) . 这有效,但有一些严重的问题,我没有解释为什么我猜,因为这只是再次触摸视图,但在某个x y .

  • 拦截触摸事件并始终将它们传递给基础视图 .

但这一切都很麻烦,这似乎是不受欢迎的行为,首先没有?

看起来像scrollview在发生onfling之后拦截所有内容,直到新的正常(无法抛出)向上和向下触摸 .

<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 回答

  • 0

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

    你为什么需要这样的布局?

相关问题