// Self-introduction of the corresponding package,
1 Public classMainactivityextendsActivity {2 3@SuppressLint ("Inlinedapi") 4 @Override5 protected voidonCreate (Bundle savedinstancestate) {6 Super. OnCreate (savedinstancestate); 7 GetWindow (). Requestfeature (Window.feature_no_title); 8 if(VERSION. Sdk_int >=Version_codes. LOLLIPOP) {9window window =GetWindow (); Ten Window.clearflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS One|WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); A Window.getdecorview (). setsystemuivisibility (View.system_ui_flag_layout_fullscreen -|view.system_ui_flag_layout_hide_navigation -|view.system_ui_flag_layout_stable); the window.addflags (WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - Window.setstatusbarcolor (color.transparent); - Window.setnavigationbarcolor (color.transparent); - } + - Setcontentview (R.layout.activity_main); + } A at}
Android full transparency status bar effect (my phone Android version is 4.2.2)