Android 显示系统live Wallpaper
来源:互联网 发布:宇通 金龙 知乎 编辑:程序博客网 时间:2024/05/01 06:04
在实现某些app时,有时需要显示系统的动态背景图片,参照以下步骤则可实现:
1.TestActivity
设置FLAG_SHOW_WALLPAPER 的作用是让系统背景显示在此应用的下层。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
}
2.AndroidManifest.xml
为activity添加属性 android:theme="@style/Theme.Translucent.NoTitleBar",可以让此应用的背景设置为透明,从而看到下层的系统背景。
<activity
android:name=".TestActivity"
android:theme="@style/Test.Translucent">
</activity>
3.styles.xml 以下xml的添加是为了解决在activity切换过程中闪现桌面的问题,需要将Theme.Translucent.NoTitleBar 的部分属性做修改
<style name="Test.Translucent" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowBackground"> @android:color/transparent</item>
<item name="android:colorBackgroundCacheHint"> @android:color/transparent</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowAnimationStyle"> @android:style/Animation</item>
</style>
1.TestActivity
设置FLAG_SHOW_WALLPAPER 的作用是让系统背景显示在此应用的下层。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
}
2.AndroidManifest.xml
为activity添加属性 android:theme="@style/Theme.Translucent.NoTitleBar",可以让此应用的背景设置为透明,从而看到下层的系统背景。
<activity
android:name=".TestActivity"
android:theme="@style/Test.Translucent">
</activity>
3.styles.xml 以下xml的添加是为了解决在activity切换过程中闪现桌面的问题,需要将Theme.Translucent.NoTitleBar 的部分属性做修改
<style name="Test.Translucent" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowBackground"> @android:color/transparent</item>
<item name="android:colorBackgroundCacheHint"> @android:color/transparent</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowAnimationStyle"> @android:style/Animation</item>
</style>
- Android 显示系统live Wallpaper
- Creating Android live wallpaper
- Android Live Wallpaper
- Android动态壁纸 Live Wallpaper
- live wallpaper
- Live Wallpaper
- android关于动态壁纸live WallPaper
- Android Live Wallpaper动态壁纸开发
- Android动态壁纸 Live Wallpaper(WallpaperService.Engine)
- Android 静态/动态壁纸(Live wallpaper)开发-WallpaperService
- Live Wallpaper动态壁纸开发
- Live Wallpaper动态壁纸开发
- Live Wallpaper动态壁纸开发
- Live Wallpaper 应用程序的总结
- 动态壁纸Live Wallpaper架构
- android 2.1 live wallpaper原理研究,大家一起来探讨下吧
- wallpaper显示相关问题
- 在Ubuntu16.10下使用Live Wallpaper
- "No match" error while execute the excutable
- nyoj489哭泣的天使
- Android手机中紧急号码的定制
- CentOS (RedHat) 6.2 使用 OpenLDAP
- 如何查找网上的资源
- Android 显示系统live Wallpaper
- imagemagick, imagick和magickwand编译安装
- x86版本Qtopia2.2.0的配置与编译
- 11月12日,EL表达式
- JavaBean _JSP
- 2012第37届ACM/ICPC中国区成都站总结
- 从今天起每日一博,逼自己每天都要学习。
- Windows与Linux拷贝数据
- Gridview导出到Excel并下载