【发布时间】:2012-08-24 10:11:45
【问题描述】:
我正在开发 Android -Sandwich 类型的特殊 UI,即 GLSurfaceView 上的一个小型 GalleryView(带有透明区域),位于背景视图(LinearLayout+一些小部件)之上。这就是我正在考虑的设置方式:
<User>
顶部视图
---画廊视图
|
---GLSurfaceView(带透明区域)
|
---LinearLayout(带小部件)
底视图
在普通模式下,GLSurfaceView 在透明区域有黑色背景,所以我看不到底层,但是当我使用 setZOrderOnTop(true);我可以看到底层,但顶层(画廊)也位于 Glsurface 视图的后面。如何在架构中完成所需的视图?
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>
【问题讨论】:
-
我没有从我们这里得到你想要的东西?在编写 XML 布局方面需要帮助吗?
-
我认为问题不在于布局,而在于 GLSurfaceView 设置。默认情况下,无论我做什么,它都不会显示透明区域,直到我没有 setZOrderOnTop(true);,但是这个设置将表面一直放在顶部......所以如何拥有相同的布局组成并在其中具有透明区域Glsurfaceview ?
标签: android android-layout glsurfaceview