Android:将activity设置为弹出式的并设置为透明的
来源:互联网 发布:矩阵A B的逆 编辑:程序博客网 时间:2024/05/09 12:41
1. 在res/values 下建立color.xml
2. 在res/values下建立style.xml
PS: #80是透明度的值(即80%透明),ffffff是颜色值(为黑色)<resources> <color name="transparent_background">#80ffffff</color> </resources>
2. 在res/values下建立style.xml
<resources><style name="Transparent" parent="android:style/Theme.Dialog"><item name="android:windowBackground">@color/transparent_background</item><item name="android:windowNoTitle">true</item><item name="android:windowIsTranslucent">true</item><item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item></style></resources>
PS: parent="android:style/Theme.Dialog" 是将activity设置为弹出式窗口
3. 在AndroidManifest.xml中找到要弹出的activity,加入theme:
3. 在AndroidManifest.xml中找到要弹出的activity,加入theme:
<activity android:name="ActivityName"android:theme="@style/Transparent"/>
完成上面设置后,你的activity就已经是透明的了,但是该Activity中的控件还没有透明,如果还需要控件透明,则需要在该activity的代码中加入如下代码:
//设置activity中的控件透明Window window = getWindow();WindowManager.LayoutParams wl = window.getAttributes();wl.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;wl.alpha=0.95f;//设置透明度,0.0为完全透明,1.0为完全不透明window.setAttributes(wl);
- Android:将activity设置为弹出式的并设置为透明的
- Android将activity设置为弹出式的并设置为透明的
- Android:将activity设置为弹出式的并设置为透明的
- 如何将Activity设置为透明的
- 将Activity设置为透明
- 自定义的activity设置为透明色
- Android设置Activity背景为透明style发生的错误
- 将图片的背景设置为透明
- Android做一个透明的Activity,设置Activity背景为透明style
- Android设置Activity背景为透明style
- Android设置Activity背景为透明style
- Android设置Activity背景为透明style
- Android设置Activity背景为透明style
- android将控件设置为透明色
- 设置Activity、AppcompatActivity为透明
- 安卓设置Activity的背景色为透明
- ActionBar设置为透明的
- android 设置activity为对话框,且背景为透明
- 线程池的原理和连接池的原理
- Hibernate 关系映射 —— 双向多对多
- 未能加载文件或程序集“file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0
- JAVA注解
- Google搜索原理
- Android:将activity设置为弹出式的并设置为透明的
- pg数据库备份恢复
- DataTable转换成List<T>
- [git] HOWTO work with git flow
- 机房收费下机中用到的策略与职责链解析
- adb shell 命令详解(转)
- HTML5之IndexedDB使用详解
- POJ 2771 Guardian of Decency(最大独立点集)
- Camera源码分析(android2.2)