Some time ago, the immersion status bar was used in the project, and here the code is as follows:
Package com.jackie.immersive;
Import Android.os.Build;
Import Android.os.Bundle;
Import android.support.v7.app.AppCompatActivity;
Import Android.view.View; public class Mainactivity extends appcompatactivity {@Override protected void onCreate (Bundle savedinstancestate)
{super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
@Override public void Onwindowfocuschanged (Boolean hasfocus) {super.onwindowfocuschanged (hasfocus);
if (Hasfocus && Build.VERSION.SDK_INT >=) {View Decorview = GetWindow (). Getdecorview (); Decorview.setsystemuivisibility (view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | View.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation | View.system_ui_flag_fullscreen |
View.system_ui_flag_immersive_sticky); }
}
}
The effect is as follows:
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.