First, create the colors. xml file under Res/Values and write:
- <? XML version = "1.0" encoding = "UTF-8"?>
- <Resources>
- <Color name = "Transparent" >#9000 </color>
- </Resources>
This value sets the transparency of the entire interface. To see the effect, it is now set to about 56% (9/16.
Create styles. xml under Res/values/and set the program style.
- <? XML version = "1.0" encoding = "UTF-8"?>
- <Resources>
- <Style name = "Transparent">
- <Item name = "Android: windowbackground"> @ color/transparent </item>
- <Item name = "Android: javaswistranslucent"> true </item>
- <Item name = "Android: windowanimationstyle"> @ + Android: style/animation. translucent </item>
- </Style>
- </Resources>
In the last step, use styles. xml on the corresponding activity. Add any <activity> tag in androidmanifest. xml
- Android: theme = "@ style/transparent"
If you want to set all the activities to use this style, you can add this label statement to <Application>.
Finally, run the program. Haha, do you find that the entire interface is covered with a translucent layer. Finally, you can replace the background color #9000 with #0000. After running the program, the background color is completely transparent, and the operations on everything in the visible background are ineffective.
Source