In fact, the setup is relatively simple, I used a few models of Xiaomi and HTC can be used.
The main code is this (note to call before the activity's Setcontentview)
/** * Open the immersive status bar */public staticvoid Openimmersestatasbarmode (activity activity) { if (Build.VERSION.SDK_INT >= Build.version_codes. KITKAT) { = Activity.getwindow (); Window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT _status); Window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_ translucent_navigation); } }
Then set the application theme style to no theme in manifest android:theme= "@android: Style/theme.notitlebar" >
This is set up after the run for, you will find the content and status bar overlap, it's OK, set a paddingtop on the line.
Demo Address: Http://files.cnblogs.com/files/wangyuehome/TestStatusBar.zip
Android immersive status bar settings (4.4 or later)