小编pro*_*t0n的帖子

如何在Android视图之间添加GLSurfaceView?

我正在使用Android -Sandwich类型的特殊UI,GLSurfaceView上的一个小GalleryView(带有透明区域)在背景View(LinearLayout +一些小部件)之上.这就是我想要设置它的方式:

<User>
Run Code Online (Sandbox Code Playgroud)

TOP View
--- GalleryView
|
--- GLSurfaceView(带透明区域)
|
--- LinearLayout(带小部件)
BOTTOM View

在常规模式下,GLSurfaceView在透明区域上有黑色背景,所以我看不到底层,但是当我使用setZOrderOnTop(true)时; 我可以看到底层,但顶层(图库)也落后于Glsurface视图.如何在模式中完成所需的视图?

XML code dummy示例(使用AnalogClock而不是GalleryView):

<?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>
Run Code Online (Sandbox Code Playgroud)

android glsurfaceview android-layout

6
推荐指数
1
解决办法
1010
查看次数

标签 统计

android ×1

android-layout ×1

glsurfaceview ×1