4
是否可以在GLSurfaceView上添加LinearLayout? 如何通过GLSurfaceView叠加LinearLayout? 也许GLSurfaceView是Game playground,而LinearLayout是菜单式的〜Android GLSurfaceView
是否可以在GLSurfaceView上添加LinearLayout? 如何通过GLSurfaceView叠加LinearLayout? 也许GLSurfaceView是Game playground,而LinearLayout是菜单式的〜Android GLSurfaceView
使用一个FrameLayout。将GLSurfaceView作为FrameLayout中的第一个视图,然后再添加LinearLayout。这将使的LinearLayout和任何在它在GLSurfaceView的顶部:
<FrameLayout
android:id="@+id/graphics_frameLayout1"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent">
<android.opengl.GLSurfaceView
android:id="@+id/graphics_glsurfaceview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</android.opengl.GLSurfaceView>
<LinearLayout
android:layout_height="fill_parent"
android:id="@+id/linearLayout1"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="vertical">
</LinearLayout>
</FrameLayout>
编辑:现在用图片:
我已经基本上做到了这一点与JAVA而不是XML,但glSurfaceView有一个固有的onDraw方法,看来这个方法总是把glSurface带回顶部.. – erik
你怎么使用glSurfaceView?你在扩展它还是附加一个渲染器? –
扩展它并做relview.addview(glView); – erik