Android API Demos 2.2 SetWallpaper, Translucent和TranslucentBlur
2010-10-19 20:16:10 来源:WEB开发网Xml代码
1. < style name="Theme.Translucent">
2. < item name="android:windowIsTranslucent">true< /item>
3. < item name="android:windowBackground">@drawable/translucent_background< /item>
4. < item name="android:windowNoTitle">true< /item>
5. < item name="android:colorForeground">#fff< /item>
6. < /style>
< style name="Theme.Translucent">
< item name="android:windowIsTranslucent">true< /item>
< item name="android:windowBackground">@drawable/translucent_background< /item>
< item name="android:windowNoTitle">true< /item>
< item name="android:colorForeground">#fff< /item>
< /style>
如果同时android:windowBackground为白色时,就是全透明的效果了。
TranslucentBlur
设置window背景为半透明状态并且被掩盖的Activity为模糊状。
主要相关代码:
先设置当前window的背景为半透明状态。然后设置底下的window为模糊状。在setContentView之前调用。
Java代码
1. // Have the system blur any windows behind this one.
2. getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
3. WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
// Have the system blur any windows behind this one.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
更多精彩
赞助商链接