4

是否可以在 GLSurfaceView 上添加 LinearLayout?如何在 GLSurfaceView 上覆盖 LinearLayout?或许 GLSurfaceView 是 Game playground 而 LinearLayout 是 menubar~

4

1 回答 1

12

使用框架布局。将 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>

编辑:现在有图片:

用于游戏的 Android 框架布局。 看看 ma ms paint Skillz

于 2011-11-22T16:08:05.820 回答