首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android设立透明的Activity

2012-09-27 
Android设置透明的Activity按下面几个步骤来:1 创建颜色文件:res-values-colors.xml,加入如下代码?xml ve

Android设置透明的Activity

按下面几个步骤来:

1 创建颜色文件:res-values-colors.xml,加入如下代码

<?xml version="1.0" encoding="utf-8"?>
<resources>
?<color name="transparent">#9000</color>
</resources>


?

2 创建style文件:res-values-styles.xml,加入如下代码:

<?xml version="1.0" encoding="utf-8"?>
<resources>
?<style name="translucent">

??<item name="android:windowBackground">@color/transparent</item>

??<item name="android:windowIsTranslucent">true</item>

??<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>

?</style>
</resources>


?

3 在AndroidManirest.xml中加入使用Theme,如下:

??<activity android:name=".MainMenu" android:theme="@style/translucent"

android:label="@string/app_name"
???>

??</activity>

?

以上三步都实现就可以实现透明的效果了。

?

利用这个技术,可以实现下图的效果了,你懂的:

Android设立透明的Activity

http://blog.sina.com.cn/s/blog_4b9b6ad00100o7wn.html

热点排行