[Android Samples视频系列之ApiDemos] AppActivityTranslucentBlur和Wallpaper

1.Demo说明与演示

  • TranslucentBulr :这个例子和Translucent不同的一点是Blur,也就是显示在当前Activity背后的其它Activity以模糊方式显示。这是通过window对象Flag来设置的
  • Wallpaper:Wallpaper介绍一个Activity如何通过Style把系统Wallpaper作为当前Activity的背景

Demo演示

2.视频讲解

http://www.eyeandroid.com/thread-11139-1-1.html

3.Demo分析

这个例子和Translucent不同的一点是Blur,也就是显示在当前Activit背后的其它Activity以模糊方式显示。

这是通过window对象Flag来设置的。

 
  1. getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,  
  2.  WindowManager.LayoutParams.FLAG_BLUR_BEHIND);  

其它设置Theme和Translucent示例一样。

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Wallpaper介绍一个Activity如何通过Style把系统Wallpaper作为当前Activity的背景。

这是WallpaperActivity在AndroidManifest.xml中的定义:

<activity android:name=”.app.WallpaperActivity”
android:label=”@string/activity_wallpaper”
android:theme=”@style/Theme.Wallpaper”>
<intent-filter>
< action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.SAMPLE_CODE” />
< /intent-filter>
< /activity>

@style/Theme.Wallpaper定义如下:继承系统android:style/Theme.Wallpaper,并将前景色设为白色(这里是文字的颜色)

<!– A theme that has a wallpaper background.  Here we explicitly specify
that this theme is to inherit from the system’s wallpaper theme,
which sets up various attributes correctly. –>
<style name=”Theme.Wallpaper” parent=”android:style/Theme.Wallpaper”>
<item name=”android:colorForeground”>#fff</item>
< /style>



4.这个Demo我们学会了

Android应用开发——系统自带样式Android:theme

http://www.eyeandroid.com/thread-8106-1-1.html

原文地址:https://www.cnblogs.com/eyeandroid/p/2810657.html