Law One:
Now many applications are referencing the immersive status bar, such as QQ, effect:
This effect is very cool, in fact, the setting is very simple.
However, this effect can only be achieved in the API19 and above versions.
If you want to achieve this effect in the interface activity, the code looks like this:
if (VERSION. Sdk_int>= Version_codes. KITKAT) {
Transparent status bar
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
Transparent navigation bar
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
Version_codes. KitKat is the name of API19, only the mobile phone system version is greater than 19, only execute the code in the judgment, to show the effect of the immersion status bar.
At the same time, these lines of code should be written in Setcontentview (r.layout.xx), before the method is executed.
Put it down first so that it can be compared with the implementation process.
To remove the title bar, in Setcontentview (r.layout.xx), precede the code: requestwindowfeature (Window.feature_no_title);
To remove the title bar, in Setcontentview (r.layout.xx), precede the code: requestwindowfeature (Window.feature_no_title);
Change the API to more than 19, add the background color to the root tag, and
Law II:
Create a new values-v19 folder below the Res directory, and create a new Styles.xml file below that reads
Of course, you'll have to add it in the root tab of the layout file.
Android:cliptopadding= "true"
Android:fitssystemwindows= "true"
If you do not add this code, the layout will be close to the top, it is not good to see,
The application tag under Androidmanifest.xml references the styles.xml of the Values-v19 folder
The effect is the same.
SOURCE Download:
eclipse:http://download.csdn.net/detail/dickyqie/9586254
Android Studio:https://github.com/dickyqie/statusbardemo
Android immersion status bar and top status bar background color settings