<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<View
android:id="@+id/below"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:id="@+id/above"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
当id为above的控件View复写onTouchEvent(MotionEvent event),如果其返回值为false,TouchEvent会传递到下面的一层的控件即id为below的控件。如果不想上层的控件把触摸事件传递到下层可以把最终的返回值设为true。
onTouchEvent(MotionEvent event)的使用
最新推荐文章于 2024-03-30 09:29:19 发布