`
zhouxiaoli521
  • 浏览: 554248 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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>

 

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

 

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

设置透明的Activity

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics