There are about three ways to set the transparency effect.
1, with the Android system transparency effect:
Android:background= "@android: Color/transparent"
For example, the Set button
<button android:background= "@android: Color/transparent"
Android:textcolor= "#ffffff"/>
2, with ARGB to control
Translucent <button android:background= "#e0000000"/>
Transparent <button android:background= "#00000000"/>
3. Set Alpha
View v = Findviewbyid (r.id.content);//
V.getbackground (). Setalpha (100);//0~255 Transparency Value
--------------
Android form transparent, dark degree and other settings skills;;
Set transparency (This is the transparency of the form itself, not the background)
1 Windowmanager.layoutparams Lp=getwindow (). GetAttributes ();
2 lp.alpha=0.3f;
3 GetWindow (). SetAttributes (LP);
Alpha is between 0.0f and 1.0f. 1.0 completely opaque, 0.0f completely transparent
Set Dark degrees
1,windowmanager.layoutparams Lp=getwindow (). GetAttributes ();
2, lp.dimamount=0.5f;
3, GetWindow (). SetAttributes (LP);
4, GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_DIM_BEHIND);
Dimamount between 0.0f and 1.0f, 0.0f completely dim, 1.0f full Dark
Set background blur
1,getwindow (). SetFlags (WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
2, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
The above settings are also valid for the dialog dialog box
Settings for transparent, translucent effects of activity transparent
Res/values/styles.xml
<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>
Res/values/color.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<color name= "Transparent_background" > #50000000 </color>
</resources>
Attention:
The first two bits of the color.xml #5000000 are transparent effect parameters from 00--99 (transparent-not very transparent),
The post 6 bit is the color setting
Manifest.xml
<activity
Android:name= ". Transparentactivity "
Android:theme= "@style/transparent" >
</activity>
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
SetTheme (r.style.transparent);
Setcontentview (r.layout.transparent);
}
Configuration ends.
Transparency--set transparency, translucency, and other effects