Other methods of translucent activity in Android

Source: Internet
Author: User

Time 2014-03-05 14:50:28 csdn Blog original http://blog.csdn.net/sunalongl/article/details/20544177

In the project, often need to use the dialog box effect, but the dialog box is not easy to write, so you want to write a translucent activity to replace the dialog box effect, the benefits of at least three:

One: Easy layout

Two: Various controls are easy to control

Three: Code concise: Do not write Control dialog box code in a lump, all kinds of control do not write in a lump, easy to maintain

And now in the online search for translucent activity, all need to write styles in style, color, and, of course, the final configuration in the mainfest, the result of a small translucent activity effect is very messy, and on the internet and so on that several methods , see the egg hurts, so for the convenience of the next colleague, I introduce a simple translucent activity effect:

Steps:

One: Write transparent colors in the root tag of the activity's layout:

android:background= "#80000000" >                        

Two: Configure in the manifest file:

Android:theme="@android: Style/theme.translucent.notitlebar" > 

OK, just these two steps,

The benefits of this effect are:

One: simple, just two lines of code

Second: Easy to modify, just two lines of code, just modify one place.

Other methods of translucent activity in Android

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.