标签:
1 |
WindowManager.LayoutParams lp=getWindow().getAttributes(); |
2 |
lp.alpha= 0 .3f; |
3 |
getWindow().setAttributes(lp); |
1 |
WindowManager.LayoutParams lp=getWindow().getAttributes(); |
2 |
lp.dimAmount= 0 .5f; |
3 |
getWindow().setAttributes(lp); |
4 |
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
1 |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, |
2 |
WindowManager.LayoutParams.FLAG_BLUR_BEHIND); |
1
2 3 4 5 6 7 8 9 10 11 12 |
<resources>
<style name="Transparent"> <item name="android:windowBackground"> @color/transparent_background </item> <item name="android:windowNoTitle">true</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle"> @+android:style/Animation.Translucent </item> </style> </resources> |
1
2 3 4 5 6 7 |
<?xml version="1.0" encoding="utf-8"?>
<resources> <color name="transparent_background">#50000000</color> </resources> //注意: //color.xml的#5000000前两位是透明的效果参数从00--99(透明--不怎么透明), //后6位是颜色的设置 |
1
2 3 4 |
<activity
android:name=".TransparentActivity" android:theme="@style/Transparent"> </activity> |
1
2 3 4 5 |
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setTheme(R.style.Transparent); setContentView(R.layout.transparent); } |
标签:
原文地址:http://www.cnblogs.com/happyaday/p/4351091.html