透明背景 [英] Transparent Background

查看:183
本文介绍了透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能使背景50%透明?
比方说,一个AbsoluteLayout的背景,以便它的黑暗,但你仍然可以透过它看到?

How can i make the background 50% transparent?
Let's say the background of an AbsoluteLayout so it's dark but you can still see through it?

推荐答案

您可以应用透明主题所需要的活动。在/res/values​​/style.xml创建一个新的样式

You could apply a transparent theme to the required activity. Create a new style in /res/values/style.xml

<resources>
<style name="Transparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
<item name ="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
</resources>

透明的值为

<color name="transparent">#00000000</color>

现在在AndroidManifest.xml中声明该活动的主题,您刚才创建的。

Now in AndroidManifest.xml declare the theme of the activity to the one you just created.

<activity android:name="MyActivity" android:theme="@style/Transparent"></activity>

这篇关于透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆