Android GLSurfaceView - PullRequest
       13

Android GLSurfaceView

4 голосов
/ 22 ноября 2011

Возможно ли добавить LinearLayout в GLSurfaceView?Как наложить LinearLayout поверх GLSurfaceView?может быть, GLSurfaceView - игровая площадка, а LinearLayout - меню ~

1 Ответ

12 голосов
/ 22 ноября 2011

Используйте 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>

Редактировать: теперь с изображением:

Android Framelayout for games. Check out ma ms paint skillz

...