[Android] Background color

Button transparent:

 

半透明<Button android:background="#e0000000" ... /> 
透明<Button android:background="#00000000" ... />

 

Color and opacity (alpha) values ​​are expressed in hexadecimal notation. The value range for any one color is 0 to 255 (00 to ff). For alpha, 00 is fully transparent and ff is fully opaque. The expression order is "aabbggrr", where "aa=alpha" (00 to ff); "bb=blue" (00 to ff); "gg=green" (00 to ff); "rr=red" (00 to ff) ff). For example, if you wanted to apply a 50% opacity blue to an overlay, you would specify the following value: 7fff0000

Set Background Image Transparency (Super Simple)

Java code

  1. View v = findViewById(R.id.content);//Find the id of the layout you want to set a transparent background
  2. v.getBackground().setAlpha(100);//0~255 transparency value

 

Layout background transparent:

 

method one:

Just add

android:theme="@android:style/Theme.Translucent"  to the activity attribute configuration in the configuration file

.

This calls android's transparent style!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325560415&siteId=291194637