Android set the simple method of setting the activity background to transparent style (must SEE) _android

Source: Internet
Author: User
Tags transparent color

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 ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.