我有框架布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" >
<LinearLayout
android:id="@+id/widgetView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="10dp"
android:gravity="center" >
</LinearLayout>
<LinearLayout
android:id="@+id/widgetOverlayFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false" >
</LinearLayout>
第一个布局包含小部件布局,第二个是透明的并接收 onLongClick 用于拖动方法。这有效,问题是当我想与小部件交互时,单击某些东西时,单击事件由 overlayFrame 获取。如何通过overlayFrame将点击事件传递给widgetView?
编辑:
现在我正在尝试将 GestureLister 附加到 overlayFrame LinearLayout,以某种方式查看代表单击和长按的 MotionEvent 之间的区别。我面临的问题是手势监听器中的 OnLongPress 总是被称为无论我做什么,单击或长按。
这种行为有解释吗?天呐!