Method One:
Through Theme.translucent
@android: Style/theme.translucent
@android: Style/theme.translucent.notitlebar
@android: style/ Theme.Translucent.NoTitleBar.Fullscreen
You only need to set theme as one of the above in the manifest activity that you need to be transparent.
<activity
android:name= "com.vixtel.simulate.MainApp"
android:configchanges= "keyboardhidden| Orientation "
android:label=" @string/app_name "
android:screenorientation=" Portrait "
android:theme=" "@android: Style/theme.translucent.notitlebar" >
<intent-filter>
<action android:name= " Android.intent.action.MAIN "/>
<category android:name=" Android.intent.category.LAUNCHER "/>"
</intent-filter>
Method Two:
Custom style, just like custom dialog style, add transparent color values to Res-values-color.xml:
<?xml version= "1.0" encoding= "UTF-8"?>
<resources>
<color name= "Transparent" > #0000 </ Color>
Add the following in Res-values-styles.xml:
<style name= "Mytransparent" >
<item name= "Android:windowbackground" > @color/transparent</item >
<item name= "Android:windownotitle" >true</item>
<item name= "Android: Windowistranslucent ">true</item>
<item name=" Android:windowanimationstyle "> @android: style/ Animation.translucent</item>
In manifest you need to set theme for us in a transparent activity.
Android:theme= "@style/mytransparent"
After running the program, it is completely transparent, see all the things in the background can not be manipulated.
The above is a small series for everyone to bring the Android set activity background for transparent style of the simple method (must see) all content, I hope that we support the cloud-Habitat Community ~