2011-11-22 4 views
4

GLSurfaceView에 LinearLayout을 추가 할 수 있습니까? GLSurfaceView를 통해 LinearLayout을 오버레이하는 방법은 무엇입니까? 어쩌면 GLSurfaceView가 게임 놀이터이고 LinearLayout이 메뉴 바입니다 ~Android GLSurfaceView

답변

12

FrameLayout을 사용하십시오. GLSurfaceView를 FrameLayout의 첫 번째 뷰로 가져온 다음 LinearLayout 두 번째를 추가합니다.

<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> 

편집 : 이것은 GLSurfaceView의 맨 위에 그 안에있는 LinearLayout하고 새로운 것을 넣어 것입니다 지금 사진과 함께 : 내가 대신 XML을 자바하지만 glSurfaceView 본질적으로이 작업을 수행 한

Android Framelayout for games. Check out ma ms paint skillz

+0

고유 한 onDraw 메서드가 있으며이 메서드는 항상 glSurface를 맨 위로 가져옵니다. – erik

+0

어떻게 glSurfaceView를 사용하고 있습니까? 확장하거나 렌더러를 연결하고 있습니까? –

+0

확장 및 relview.addview (glView); – erik

관련 문제