Android sets the background color to transparent, android background color

Source: Internet
Author: User

Android sets the background color to transparent, android background color

Set the background color to transparent for android

Method 1:

You only need to add

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

That's all.

In this way, the android transparent style is called!

Method 2:

First, create the colors. xml file under res/values and write:
  
<? Xmlversion = "1.0" encoding = "UTF-8"?>
  
<Resources>
  
<Colorname = "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.
  
<? Xmlversion = "1.0" encoding = "UTF-8"?>
  
<Resources>
  
<Stylename = "Transparent">
  
<Itemname = "android: windowBackground"> @ color/transparent </item>
  
<Itemname = "android: javaswistranslucent"> true </item>
  
<Itemname = "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.


How does android make the background of a dialog transparent?

Is Beijing transparent? You can set the dialog Style through Style;
Android Dialog background transparent and borderless Theme Style
<Style name = "Translucent_NoTitle" parent = "android: style/Theme. Dialog">
<Item name = "android: windowNoTitle"> true </item>
<Item name = "android: background" >#00000000 </item>
<Item name = "android: windowBackground"> @ android: color/transparent </item>
<Item name = "android: colorBackgroundCacheHint"> @ null </item>
<Item name = "android: javaswistranslucent"> true </item>
</Style>

How to make the text box background transparent on the android page

You also need to set the font color. Otherwise, the font and the form background are black and nothing can be seen.
<EditText android: text = "EditText" android: id = "@ + id/editText1"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: background = "@ null"
> </EditText>

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.