Android set background color to transparent
Method One:
As long as the activity property is configured within the configuration file, add
Just fine.
This invokes the Android transparent style!
Method Two:
First build the Colors.xml file under Res/values, write:
<? xmlversion= "1.0" encoding= "UTF-8 " ?> < Resources > < ColorName = "Transparent" >#9000</color></resources>
This value sets the transparency of the entire interface, and is now set to about 56% (9/16) of the transparency to see the effect.
Then build Styles.xml under Res/values/, set the style of the program
<?xmlversion= "1.0" encoding= "Utf-8 "?> <Resources> <stylename= "Transparent"> <Itemname= "Android:windowbackground">@color/transparent</Item> <Itemname= "Android:windowistranslucent">True</Item> <Itemname= "Android:windowanimationstyle">@+android:style/animation.translucent</Item> </style> </Resources>
The last step is to use this styles.xml in the corresponding activity. That is, add any <activity> tags in the androidmanifest.xml
Android:theme= "@style/transparent"
If you want to set all the activity to use this style, you can add this tag statement in <application>.
Finally run the program, is not found that the entire interface is covered with a layer of translucent. Finally can change the background color #9000 to #0000, after running the program, it is completely transparent, see the background of all things can be invalid operation.
Android settings 2 ways to have activity background color transparent