set the background color to transparent android

set the background color to transparent android

method one:

Only to add in the configuration file activity within the property configuration

android:theme="@android:style/Theme.Translucent" 

Enough.

This is called transparent style of android.

Method Two:

First built in the under res / values colors.xml file, write:
  
  <?

xmlversion="1.0"encoding="UTF-8"?

>
  
  <Resources>
  
  <colorName = "transparent"> # 9000 </ Color>
  
  </ Resources>
  
  this value is set to transparency of the entire interface. In order to see results. Now set the Opacity to 56% (9/16) around.
  
  Build style styles.xml, set up a program under RES / values /
  
  <?

xmlversion="1.0"encoding="utf-8"?

>
  
  <Resources>
  
  <styleName = "Transparent">
  
  <itemName = "Android: windowBackground"> @ Color / transparent </ Item>
  
  <itemName = "Android: windowIsTranslucent"> to true </ Item>
  
  <itemName = "Android: windowAnimationStyle" > Android @ +: style / Animation.Translucent </ Item>
  
  </ style>
  
  </ Resources>
  
  final step, this styles.xml used in the corresponding Activity. That in AndroidManifest.xml random <activity> tag add
  
  android: theme = "@ style / transparent"
  
  Suppose you want to set all activity uses this style, the sentence can label the statement added <application> in.
  
  The last execution. Haha. Is not find the whole interface are covered with a layer of translucent. Finally able to put into the background color # 9000 # 0000, after the execution of the program, it is fully transparent, and all things in the background can see but had no effect.

Guess you like

Origin www.cnblogs.com/mqxnongmin/p/10959927.html