具有透明背景的活动 [英] Activity with transparent background
问题描述
我想要实现的是具有类似对话框的透明性且具有100%的RelativeLayout内容可见性的活动.这是活动的xml:
what I want to achieve is activity with dialog-like transparency with 100% visibility of RelativeLayout content. This is activity's xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:layout_marginTop="50dip">
(...)
</RelativeLayout>
</LinearLayout>
这很明显:
<activity
android:name="com.acentic.rcontrol.activities.MyActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
</activity>
现在背景仍然可见,我在做什么错了?
Right now background is still visible, what am I doing wrong?
--- 我加了
android:background="#c0000000"
到LinearLayout.现在背景如我所愿是透明的,但是RelativeLayout中的TextViews也是透明的..如何更改它?
to LinearLayout. Now background is transparent as I wanted to, but also TextViews inside RelativeLayout are also transparent.. how to change it?
推荐答案
设置LinearLayout透明度后,尝试将其子透明度设置为所需的值. 这应该使它们具有与LinearLayout不同的透明度.试试吧.
After setting LinearLayout transparency try to set it's child transparency to the value that you want. This should make them have different transparency than LinearLayout. Try it.
这篇关于具有透明背景的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!