//determine the Android version and then set the Systembar color Public voidInitsystembar () {window window=GetWindow (); //version 4.4 and above if(Build.VERSION.SDK_INT >=Build.version_codes. KITKAT) {window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } //version 5.0 and above if(Build.VERSION.SDK_INT >=Build.version_codes. LOLLIPOP) {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); } Tintmanager=NewSystembartintmanager ( This); //Open SystembartintTintmanager.setstatusbartintenabled (true); }
Android status bar compatible 4.4.4 with 5.0,android5.0 status bar set by translucency to full transparency