6

私はAndroidの特別なUIに取り組んでいます-サンドイッチタイプ、背景ビュー(LinearLayout +いくつかのウィジェット)の上にあるGLSurfaceView(透明な領域を持つ)の小さなGalleryViewです。これは私がそれを設定する方法を考えている方法です:

<User>

TOP ビュー
---GalleryView
|
---GLSurfaceView(透明部分あり)
|
---LinearLayout(ウィジェットあり)
BOTTOM View

通常モードの GLSurfaceView では、透明な領域に黒い背景があるため、下のレイヤーが表示されませんが、 setZOrderOnTop(true); を使用すると、下のレイヤーが表示されます。一番下のレイヤーが見えますが、一番上のレイヤー(ギャラリー)もGlsurfaceビューの背後にあります。スキーマのように目的のビューを実現するにはどうすればよいですか?

XML コードのダミーの例 (GalleryView の代わりに AnalogClock を使用):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#920000"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/LinearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right" >

        <AnalogClock
            android:id="@+id/analogClock2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <com.test.CustomGlView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/gl_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

    <AnalogClock
        android:id="@+id/Gallery_dummyview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>
4

1 に答える 1

3

これはできません。

GLSurfaceView の Surface は、View ベースの UI とは別の合成レイヤーにあります。ビューの上または下に配置できますが、ビュー要素の間に挟まれて表示されることはありません。

代わりに TextureView (API 14+) を使用できます。レンダリング先の Surface がありますが、アプリによってビュー レイヤーに合成されるため、レイアウトは他のビューと同じように機能します。GLSurfaceView にあるものに依存するのではなく、独自の EGL セットアップと GLES のスレッド管理を提供する必要がありますが、Grafika で例を見つけることができます

于 2015-07-06T17:35:04.857 に答える