android设置Activity背景透明
16lz
2021-12-04
1.如果设置成完全透明
在Manifest.xml中给要设置成背景透明的acticity增加属性:android:theme="@android:style/Theme.Translucent"
2.如果想把背景设置成某个颜色
(1)在/value目录下增加文件color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="light_drak">#50ffffff</color>
</resources>
(2)在/value目录下增加文件style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Transparent">
<item name="android:windowBackground">@color/light_drak</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
(3)在Manifest.xml中给要设置成背景透明的acticity增加属性:android:theme="@style/Transparent"
这样就可以了
更多相关文章
- Android(安卓)修改EditText的光标颜色和背景色
- A06_RelativeLayout的属性设置
- animation的xml定义中的android:interpolator属性
- 在android中增加公用资源包(类似framework-res.apk)
- android视图切换动画:ViewAnimator类及其子类
- Android之通过shape.xml制作渐变背景色
- android:configChanges属性总结
- android背景选择器selector用法汇总
- android init.rc增加一个自定义的service