2014-10-23 7 views
0

다른 레이아웃 사이에 GLSurfaceView를 배치하는 데 문제가있었습니다. GLSurfaceView로는 불가능합니다. 그래서 TextureView로 GLSurfaceView를 대체했지만 문제는 해결되지 않았습니다.안드로이드의 다른 레이아웃 사이에 TextureView를 올바르게 배치하는 방법은 무엇입니까?

나는 내 주요 레이아웃과 같은 구조를 가지고 :

<RelativeLayout android:id="@+id/mainEngineLayout" 
       android:layout_width="match_parent" 
       android:layout_height="fill_parent" 
       android:background="@android:color/transparent" 
       tools:context=".activities.MyActivity"> 

    <com.myapplication.views.openGL.myGLTextureView 
      android:id="@+id/myGLTextureView" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginLeft="66dp" 
      android:layout_marginRight="66dp"/> 

    <LinearLayout 
      android:id="@+id/leftButtonsLayout" 
      android:layout_height="fill_parent" 
      android:layout_width="66dp" 
      android:layout_alignParentLeft="true" 
      android:orientation="vertical" 
      android:background="#b7b8b0"> 

     <ImageButton android:layout_width="66dp" .../> 
     <ImageButton android:layout_width="66dp" .../> 

    </LinearLayout> 

    <FrameLayout 
      android:layout_height="fill_parent" 
      android:id="@+id/rightLayout" 
      android:layout_width="wrap_content" 
      android:layout_alignParentRight="true" 
      android:orientation="vertical" 
      android:background="#b7b8b0"> 

     <ImageButton android:layout_width="66dp" .../> 
     <ImageButton android:layout_width="66dp" .../> 

    </FrameLayout>  

</RelativeLayout> 

을 그리고 마지막으로 내가 얻을 같은 결과를 원하는 :

enter image description here

문제는 내가하지에 문제가있어 일부 장치에 그입니다 TextureView가 전혀 표시되지 않으므로 왼쪽 및 오른쪽 레이아웃 사이에 검은 색 필드가 나타납니다.

예를 들어 삼성 S3 및 에뮬레이터에서 작동하며 Xperia에서 제대로 작동하지 않습니다. 나는 이유는 다른 테마에있을 수 있습니다 생각하지만 내가 좋아하는 내 매니페스트 파일에 테마를 설정합니다 "CustomHoloThemeNoActionBar" parent="@android:style/Theme.Holo.Light"

당신이 같은 문제를 일으킬 수있는 조언을 주실 수

<application 
    android:allowBackup="true" 
    android:configChanges="orientation|screenSize" 
    android:theme="@style/CustomHoloThemeNoActionBar" 
    android:screenOrientation="sensorLandscape" 
    android:largeHeap="true"> 
    <activity 
     android:theme="@style/CustomHoloThemeNoActionBar" 

?

+0

난 당신이 안드로이드 사용할 수 있습니다 생각 : 오른쪽으로 레이아웃을 얻을 수 layout_toRightOf을 .. . android : layout_toLeftOf. 레이아웃을 왼쪽으로 바꾼다 .... anther 레이아웃 id로 도트 바꾸기 –

+0

layout_toRightOf와 layout_toLeftOf를 사용하는 경우 myGLTextureView를 나에게 적합하지 않은 '왼쪽'과 '오른쪽'레이아웃 뒤에 놓아야한다. TextureView를 배경처럼 첫 번째 레이아웃으로 만들고 싶습니다. – XZen

+0

android : gravity = "center" –

답변

0

은 내가

당신이 사용할 수있는 비율을 해결하기를 분할하려는 경우가

enter image description here

처럼 보이게 할 방법에 따라, 당신은 중력 중심 (layout_gravity)를 설정해야한다고 생각 무게 재산

enter image description here

+0

불행히도 도움이되지 않았습니다. 사실 왜 중력이 다른 레이아웃에 의해 TextureView의 '겹침'문제에 영향을 줄 수 있는지 이해하지 못했습니다 – XZen

+0

android : layout_centerInParent = "true"또는 android : layout_centerHorizontal = "true"나는 당신과 함께이 작품을 희망합니다. –