We can often see that opening a new app will have a beginner's guide interface, similar to the masking effect today. The principle is actually very simple, set a transparent activity or dialog, and then modify its properties. Because the implementation is relatively simple, a part of the code is pasted.
1. Increase in Androidmanifest.xml
1 < Activity 2 Android:name =". Transparentactivity " //Your activity3 android:theme=" @style/ Transparencetheme ">4</activity>
2. Modify Styles.xml to add the following content
1 <stylename= "Transparencetheme" >2 <Itemname= "Android:windowbackground">@color/Custom Colors</Item>3 <Itemname= "Android:windownotitle">True</Item>4 <Itemname= "Android:windowistranslucent">True</Item>5 <Itemname= "Android:windowanimationstyle">@android: Style/animation.translucent</Item>6 </style>
3. Some notes
If you want the mask effect to not see the system notification bar on the Android machine, you can add the styles.xml corresponding style on the
1 < name= "Android:windowfullscreen">true</item>
In addition, to keep the system notification bar and want the transparency effect, you can add the following in the activity initialization you set (currently only support android4.4 version)
1 if(Build.VERSION.SDK_INT >=Build.version_codes. KITKAT) {2window window =GetWindow ();3 //Translucent status Bar4 Window.setflags (5 WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,6 WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);7 //Translucent navigation bar8 Window.setflags (9 WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,Ten WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); One}
40.Android Beginner's Guide to interface learning