[Android Samples視頻系列之ApiDemos] App-Activity-TranslucentBlur和Wallpaper

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.