我正在开发一个特殊的Android用户界面 - 三明治类型,一个小的GalleryView在GLSurfaceView上(带有透明区域),位于背景视图(LinearLayout+一些小部件)之上。这是我考虑如何设置它:
<User>
顶部视图
---画廊视图
|
---GLSurfaceView(具有透明区域)
|
---LinearLayout(带小部件)
底部视图
在常规模式下,GLSurfaceView 在透明区域上有黑色背景,所以我看不到底层,但当我使用 setZOrderOnTop(true); 时,我可以看到底层,但顶层 (画廊) 也会被放在 GLSurfaceView 后面。如何实现像架构中所示的期望视图?
XML 代码示例(用 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>