最近我的 ScrollView 遇到了一些问题。发生滑动后,触摸事件不会到达 ScrollView 内的元素。发生闪动后,我首先需要再次点击 View ,然后恢复正常行为。我已经尝试了很多解决方法,例如:
- 在 throw 后手动触发运动事件(向上/向下)。这可行,但有一些严重的问题,我不必解释我猜的原因,因为这与再次触摸 View 相同,但在某个 x+y 点。
- 拦截触摸事件并始终将它们传递给底层 View 。
但这一切都非常麻烦,而且这看起来首先是不受欢迎的行为,不是吗?
似乎 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>
最佳答案
您有一个 ScrollView (NestedScrollView
),其中包含另一个 ScrollView (RecyclerView
)。
对我来说听起来很麻烦。
为什么需要这样的布局?
关于android - throw 后触摸被拦截,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33414912/