Android GLSurfaceView

发布于 2024-12-17 14:05:08 字数 121 浏览 4 评论 0原文

是否可以在 GLSurfaceView 上添加 LinearLayout ? 如何在 GLSurfaceView 上覆盖 LinearLayout? 也许GLSurfaceView是游戏游乐场而LinearLayout是菜单栏~

Is it possible add LinearLayout on GLSurfaceView?
How to overlay LinearLayout over a GLSurfaceView?
maybe GLSurfaceView is Game playground and LinearLayout is menubar~

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国产ˉ祖宗 2024-12-24 14:05:08

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

编辑:现在使用图片:

Use a FrameLayout. Have the GLSurfaceView as the first view in the FrameLayout, then add the LinearLayout second. This will put the linearLayout and anything in it over the top of the 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>

Edit: Now with picture:

Android Framelayout for games. Check out ma ms paint skillz

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文