The code to achieve the above effect is as follows:
public class Mainactivity extends Activity {@SuppressLint ("Inlinedapi") @Override protected void OnCreate (Bundle savedinstancesta TE) {super.oncreate (savedinstancestate); GetWindow (). Requestfeature (Window.feature_no_title); if (VERSION. Sdk_int >= 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); } setcontentview (R.layout.activity_main); }}
Android5.0 Full transparency status bar effect