結局のところ、GLSurfaceView を他のレイアウトの間に配置する際に問題が発生しました。GLSurfaceView では不可能です。そこで、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>
そして最後に、次のような結果を得たい:
問題は、一部のデバイスで TextureView がまったく表示されないという問題が発生したため、左右のレイアウトの間に黒いフィールドがあることです。
たとえば、Samsung S3 とエミュレーターでは動作しますが、Xperia では正しく動作しません。理由はさまざまなテーマにあると思いましたが、マニフェスト ファイルで次のようにテーマを設定しました。
<application
android:allowBackup="true"
android:configChanges="orientation|screenSize"
android:theme="@style/CustomHoloThemeNoActionBar"
android:screenOrientation="sensorLandscape"
android:largeHeap="true">
<activity
android:theme="@style/CustomHoloThemeNoActionBar"
どこ"CustomHoloThemeNoActionBar" parent="@android:style/Theme.Holo.Light"
このような問題を引き起こす原因を教えてください。