Now many applications are referencing the immersive status bar, such as QQ, effect:
The effect is very cool, in fact, the setting is very simple. However, it is important to note that this effect can only be done in API19 and above.
Method One:
First, if you want to achieve this effect in the interface activity, in Setcontentview (r.layout.xx); Method before adding the following code:
if (VERSION. sdk_int>=// transparent status bar // transparent navigation bar GetWindow (). Addflags (Windo WManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); }
Note: Version_codes. KITKAT is the name of API19, only the phone system SDK version is greater than 19, only execute the code in the judgment, to show the effect of the immersion status bar.
Second, the API is changed to more than 19, and the Layout root tag adds a background color.
Android immersive status bar and top status bar background color settings