2014-05-16 2 views
7

내 Android 앱은 전체 화면 OpenGL ES 2.0 앱이므로 기본 콘텐츠는 GLSurfaceView의 맞춤 확장입니다. 활동 레이아웃은 다음과 같습니다DrawerLayout 콘텐츠로 GLSurfaceView로 ListView가 그려지지 않았습니다.

<android.support.v4.widget.DrawerLayout 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:id="@+id/drawer_layout"> 
    <FrameLayout android:id="@+id/content_frame" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
    <ListView android:id="@+id/left_drawer" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:choiceMode="singleChoice" 
     android:divider="@android:color/transparent" 
     android:dividerHeight="0dp" 
     android:background="#111" /> 
</android.support.v4.widget.DrawerLayout> 

내가 다음 FrameLayout이의 addView 메서드를 사용하여 내 GLSurfaceView를 추가합니다. 이렇게하지 않으면 서랍이 예상대로 작동합니다.

ListView는 내가 왼쪽으로 다시 스 와이프하기 전까지는 GLSurfaceView와 더 이상 상호 작용할 수 없기 때문에 스 와이프하여 올바르게 꺼낸 것 같습니다. 그러나 GLSurfaceView가 그 위에 항상 렌더링되어있는 것처럼 전혀 표시되지 않습니다.

GLSurfaceView를 내용으로 사용하여 DrawerLayout을 얻으려면 어떻게해야합니까?

답변

16

난 그냥 똑같은 문제에 직면했고, 나는 그것에 대한 바보 같은 해결 방법을 발견했습니다. 이 문제는 일반 뷰가 아닌 DrawerLayouts에만 영향을 미치는 것으로 보입니다. 따라서 GLSurfaceView 위에 빈 View를 놓기 만하면 Drawer에서 마스크를 제거 할 수 있습니다.

여기 당신을 위해 샘플로 내 옷을 벗었 레이아웃 파일이다 :

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <GLSurfaceView 
      android:id="@+id/glSurfaceView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </RelativeLayout> 


    <FrameLayout 
     android:id="@+id/frameLayoutDrawer" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="match_parent" 
     android:layout_gravity="end" 
     android:background="@android:color/white" /> 
</android.support.v4.widget.DrawerLayout> 
+1

당신의 선생님이 당신의 명성을, 훌륭하게 작동합니다! 'GL View'를 동적으로 추가하는 사람들을위한 간단한 참고 사항 : 인덱스가있는'ViewGroup'에 추가 할 때 배경에 배치하기 만하면됩니다. 이렇게 : myRelativeLayout.addView (myGlView, 0);' – avalancha

관련 문제