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