[英]GLSurfaceView OnTouchEvent never called
在我的Xamarin Android应用程序中,我创建了一个带有自定义GLSurfaceView的Activity。 布局如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="Hi! I am model viewer!" />
<test.ui.droid.controls.ModelViewerGLSurfaceView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
我的自定义ModelViewerGLSurfaceView
(从GLSurfaceView派生)是需要OpenGL渲染和工作得很好。
现在,我想添加手势识别。 为了做到这一点,我在ModelViewerGLSurfaceView中重写了OnTouchEvent,但是无论我做什么,都永远不会调用此函数。
但是,当我在父Activity上覆盖OnTouchEvent时,它将起作用。
为什么从不为我的GLSurfaceView调用OnTouchEvent?
您是否偶然忘记注册onTouchListener?
您需要在视图上调用setOnTouchListener来注册回调。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.