- 1,//In the Oncreat method Setcontentview () before inserting
- Requestwindowfeature (window.feature_no_title);//Cancel title bar
- GetWindow (). SetFlags (Windowmanager.layoutparams. Flag_fullscreen,
- Windowmanager.layoutparams. Flag_fullscreen);//fullscreen
- Note: This method flashes the status bar after activating the activity and then fullscreen
- 2, in manifest configuration: <activity android:theme= "@android: Style/theme.notitlebar.fullscreen"/> Only in the current Activity display full screen
- <application android:theme= "@android: Style/theme.notitlebar.fullscreen"/> Configure full-screen display for the entire app
- 3,/**
- * Full Screen Toggle
- */
- public void Fullscreenchange () {
- Sharedpreferences mpreferences = preferencemanager.getdefaultsharedpreferences (this);
- Boolean fullscreen = Mpreferences.getboolean ("fullscreen", false);
- Windowmanager.layoutparams attrs = GetWindow (). GetAttributes ();
- System.out.println ("fullscreen value:" + fullscreen);
- if (fullscreen) {
- Attrs.flags &= (~windowmanager.layoutparams.flag_fullscreen);
- GetWindow (). SetAttributes (Attrs);
- Cancel Full Screen settings
- GetWindow (). Clearflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- Mpreferences.edit (). Putboolean ("fullscreen", false). commit ();
- } else {
- Attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
- GetWindow (). SetAttributes (Attrs);
- GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- Mpreferences.edit (). Putboolean ("fullscreen", true). commit ();
- }
- }
Android fullscreen settings and cancel fullscreen settings