草庐IT

Android GLSurfaceView

coder 2023-12-18 原文

是否可以在 GLSurfaceView 上添加 LinearLayout? 如何在 GLSurfaceView 上叠加 LinearLayout? 也许 GLSurfaceView 是 Game playground 而 LinearLayout 是菜单栏~

最佳答案

使用框架布局。将 GLSurfaceView 作为 FrameLayout 中的第一个 View ,然后添加 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 GLSurfaceView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8228738/

有关Android GLSurfaceView的更多相关文章

随机推荐