Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GLSurfaceView

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

like image 432
Somyong Ri Avatar asked Dec 17 '22 07:12

Somyong Ri


1 Answers

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

like image 172
James Coote Avatar answered Jan 11 '23 07:01

James Coote