if (Build.VERSION.SDK_INT >= build.version_codes. LOLLIPOP) {
window window = GetWindow ();
Window.clearflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
Window.getdecorview (). Setsystemuivisibility (View.system_ui_flag_layout_fullscreen
| View.system_ui_flag_layout_hide_navigation
| view.system_ui_flag_layout_stable);
Window.addflags (WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
Window.setstatusbarcolor (color.transparent);
Window.setnavigationbarcolor (color.transparent);
}
Settitlebarcolor (Status_bar, r.color.new_login_colors);
/**
* @params Status_bar Replace the status bar view
* @params Color status bar
*/
public void Settitlebarcolor (View status_bar, int color) {
try {
Set the height of the view because each model has a different height for the phone status bar
Status_bar.setlayoutparams (New Layoutparams (Layoutparams.match_parent, Screenutils.getstatusheight (this)));
Determine if the SDK version is greater than or equal to 19, greater than let him show, less than to hide, or the lower version will be more than a
if (Build.VERSION.SDK_INT = = Build.version_codes. KITKAT) {
Settranslucentstatus (TRUE);
Status_bar.setvisibility (view.visible);
} else {
Status_bar.setvisibility (View.gone);
}
Coloring the status bar
Systembartintmanager Tintmanager = new Systembartintmanager (this);
Tintmanager.setstatusbartintenabled (TRUE);
Tintmanager.setstatusbartintresource (color);
} catch (Exception e) {
E.printstacktrace ();
}
}
@TargetApi (19)
private void Settranslucentstatus (Boolean on) {
try {
Window win = GetWindow ();
Windowmanager.layoutparams winparams = Win.getattributes ();
Final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (ON) {
Winparams.flags |= bits;
} else {
Winparams.flags &= ~bits;
}
Win.setattributes (Winparams);
} catch (Exception e) {
E.printstacktrace ();
}
}
Android Settings immersive status bar