我有一个RelativeLayout
,它包含一个ListView
。
当我上下滚动列表视图时,我会在RelativeLayout的onInterceptTouchEvent()
上体验到这一点
ACTION_DOWN
被触发ACTION_MOVE
。ACTION_UP
从未被解雇过请注意:
有人能解释一下吗?
===
这是我使用的简单布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView android:id="@+id/listview"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
发布于 2014-08-17 02:06:26
如果我正确理解,您希望RelativeLayout接收ACTION_UP事件。视图组(RelativeLayout)将不会接收未来的触摸事件,除非它通过返回true来表示对第一个触摸事件的兴趣-所以您应该从onInterceptTouchEvent返回true,而不是false。
Dave在这里解释得很好:http://www.doubleencore.com/2014/01/dave-smiths-talk-from-andevcon-2013-android-touch/
摘要:返回true,而不是false。观看这段视频可以得到更好的解释:)
https://stackoverflow.com/questions/25344853
复制相似问题