android - Immersive mode on Jelly Bean - Menu bar not disappearing -
After creating my activity full screen using the sample code in the Android document: This works on the launch when I tap the screen, the menu appears with a transparent status bar and a non-transparent nav bar. The problem is, it's not time and it goes away because Docs indicates that it should be. Am i missing Impressive mode is for KitKat 4.4 and above. I do not think this is 4.4 for working below any third party API. OK you can use full screen mode for Android < For the above version 4.4 nd immersive mode set uiVisibilityChangeListner < Code> // This snippet hides the system bar Private Zero Hide SystemUI () set // // set the content to appear under the IMMERSIVE flag // System Bar, so that the content is hidden // content hidden and the size of the content Do not change. .. GetWindow () getDecorView () setSystemUiVisibility (View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN // hide the status bar | | hide View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // navigation bar View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } // This snippet shows the system bar. It removes / removes all the flags, except that the content is displayed under the system bar. Private Zero showSystemUI () {GetWindow () getDecorView () setSystemUiVisibility (View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) .. } @ Override Protected Zero to Create (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); SetContentView (R.layout.activity_main); HideSystemUI (); }
if (android.os.Build.VERSION.SDK_INT> = 19) ... {GetWindow () GetDecorView () KsetOnSystemUiVisibilityChangeListener (New OnSystemUiVisibilityChangeListener () {@Override public void OnSystemUiVisibilityChange (int visibility) {if (visibility == 0) {GetWindow () getDecorView () 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);}}}); }
Comments
Post a Comment