以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 Android 开发入门 』 (http://bbs.xml.org.cn/list.asp?boardid=56) ---- 【代码】android如何把背景色设置为透明 (http://bbs.xml.org.cn/dispbbs.asp?boardid=56&rootid=&id=126738) |
-- 作者:挥戈回日 -- 发布时间:7/15/2013 5:53:00 PM -- 【代码】android如何把背景色设置为透明 activity的背景透明,只需在只要在配置文件内activity属性配置内加上android:theme="@android:style/Theme.Translucent"就好了。 但是想要多方面的设置theme的话,就要在values里设置风格先: 加透明: 先在res/values下建colors.xml文件,写入: <?xmlversionxmlversion="1.0"encoding="UTF-8"?> <resources> <colornamecolorname="transparent">#9000</color><!--透明度--> </resources> 复制代码 这个值设定了整个界面的透明度,为了看得见效果,现在设为透明度为56%(9/16)左右。 透明度可以用#9000值调,将这个值(ARGB)改变,就会有不同效果的透明度。 再在res/values/下建styles.xml,设置程序的风格 <?xmlversionxmlversion="1.0"encoding="utf-8"?> <resources> <stylenamestylename="Transparent"> <item name="android:windowBackground">@color/transparent</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item> </style> </resources> 加了@+android:style/Animation.Translucent这句的时候就会显示出此activity会有动画切换效果 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
8,578.125ms |