方法一:

通过Theme.Translucent

@android:style/Theme.Translucent@android:style/Theme.Translucent.NoTitleBar@android:style/Theme.Translucent.NoTitleBar.Fullscreen

只需要在Manifest中需要透明的Activity内设置theme为以上任意一个就可以了

<activityandroid:name="com.vixtel.simulate.MainApp"android:configChanges="keyboardHidden|orientation"android:label="@string/app_name"android:screenOrientation="portrait"android:theme="@android:style/Theme.Translucent.NoTitleBar"><intent-filter><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER"/></intent-filter></activity>


方法二:

自定义style,就像自定义Dialog的style一样,在res-values-color.xml中添加透明颜色值:

<?xmlversion="1.0"encoding="UTF-8"?><resources><colorname="transparent">#0000</color></resources>

在res-values-styles.xml中添加如下:

<stylename="myTransparent"><itemname="android:windowBackground">@color/transparent</item><itemname="android:windowNoTitle">true</item><itemname="android:windowIsTranslucent">true</item><itemname="android:windowAnimationStyle">@android:style/Animation.Translucent</item></style>

在Manifest中中需要透明的Activity内设置theme为我们自定义的即可

android:theme="@style/myTransparent"


更多相关文章

  1. android sd卡读取数据库
  2. Android(安卓)设置圆角背景
  3. 设置Textview最大长度,超出显示省略号
  4. 【Android】编译CM10.1遇到的错误解决方案
  5. Android(安卓)应用程序请求Vsync
  6. android 模拟器上网 设置
  7. ImageView属性中android:src和android:background有什么区别
  8. android 透明效果
  9. Android(安卓)layout属性大全

随机推荐

  1. [置顶] Android省电开发 浅析
  2. Android管理篇
  3. Android属性动画—实现第三方登录的上拉
  4. Android(安卓)Https请求详细demo
  5. android EnMicroMsg.db安卓微信数据库获
  6. 再识android (一)
  7. 《Android程序设计》一3.9 把软件移植到A
  8. AIDL基础介绍
  9. 国内移动应用市场盘点(Android平台)
  10. Google公开指责微软、苹果和甲骨文试图通