Activity 透明 半透明效果的简单实现
来源:互联网 发布:淘宝号为什么会被限购 编辑:程序博客网 时间:2024/06/11 02:20
一.全透明效果
Activity实现全透明效果很容易实现,android自带的主题样式已经帮我们做好了,直接引用就可以了,在AndroidManifest.xml中的需要透明效果的activity节点下添加下面代码:
android:theme="@android:style/Theme.Translucent"或者
android:theme="@android:style/Theme.Translucent.NoTitleBar"
二.半透明效果
参考android自带样式的全透明效果(添加到styles样式中):
<style name="halfTranslucent"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowIsTranslucent">true</item> <!-- Note that we use the base animation style here (that is no animations) because we really have no idea how this kind of activity will be used. --> <item name="android:windowAnimationStyle">@android:style/Animation</item> </style>
</pre>android:windowBackground:表示背景样式(这里改成自己想要的透明程度就可以了),eg:<p></p><p></p><pre code_snippet_id="355983" snippet_file_name="blog_20140521_5_5862737" name="code" class="html"><color name="ljg_transparent_background">#90000000</color>
android:colorBackgroundCacheHint:空表示不要使用缓存
android:windowIsTranslucent":是否透明,默认给true
android:windowAnimationStyle 打开的动画样式,默认的的动画是没有的;eg:
<!-- Base style for animations. This style specifies no animations. --> <style name="Animation" />这里可以改成我们想要的动画效果具体可以参考:
\sdk\platforms\android-16\data\res\anim\里的内容
不需要标题栏的话,添加下面的代码
<item name="android:windowNoTitle">true</item><item name="android:windowContentOverlay">@null</item>
最后在AndroidManifest.xml中的需要透明效果的activity节点下添加该我们自定义的主题样式就可以了.
0 0
- Activity 透明 半透明效果的简单实现
- Activity 透明,半透明效果的设置transparent
- Activity 透明,半透明效果的设置transparent
- Activity透明/半透明效果的设置transparent(两种实现方法)
- Activity透明/半透明效果的设置transparent(两种实现方法)
- Activity透明/半透明效果的设置transparent(两种实现方法)
- Activity透明/半透明效果的设置transparent(两种实现方法)
- activity实现半透明效果
- Activity的透明、半透明效果的设置transparent
- android Activity 透明,半透明效果的设置transparent
- 文本框以及Activity透明,半透明效果的设置
- 实现Activity的透明效果
- activity半透明的效果
- 半透明效果的Activity
- android button透明和半透明效果的实现
- Activity实现透明效果
- android实现透明和半透明效果
- Android 实现透明效果的 Activity
- 配置cmake & 使用make命令
- linux制定任务计划 crontab命令
- NFS服务器安装配置实现Ubuntu 12.04与ARM文件共享
- 简单而又深刻的认识:原码、补码、反码
- 转:每天问四句话改变孩子一生
- Activity 透明 半透明效果的简单实现
- Oracle 中文乱码
- jquery中的ajax如何返回结果, 而非回调方式
- Sublime Text 3 安装Package Control
- solr 忽略大小写
- .net编译目标平台
- JS 弹出层 定位至屏幕居中
- 聚集索引和非聚集索引
- Validate Matches in Procedural Code (用程序码验证匹配)