Overflow Menu click disabling Immersive mode - Android 4.4 Kitkat
android, android-4.4-kitkat, android-fullscreen
Solution
In K, the overflow menu is a separate window that takes focus, and therefore drives the current system UI flags.
However, this only comes up if you are trying to show the action bar when the status bar is hidden, which is discouraged. For contextual menus outside of the action bar, you can use PopupWindow instead (with `PopupWindow` you can set the system UI flags yourself as needed).
Problem
Anybody know if this is a Bug or is supposed to do this. When clicking the Overflow icon while using KitKat's Immersive mode, it disables the immersive mode. Anybody else running into this? Full Code by Google - Here ``` public void toggleHideyBar() { // The UI options currently enabled are represented by a bitfield. // getSystemUiVisibility() gives us that bitfield. int uiOptions = getActivity().getWindow().getDecorView().getSystemUiVisibility(); int newUiOptions = uiOptions; boolean isImmersiveModeEnabled = ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions); if (isImmersiveModeEnabled) { Log.i(TAG, "Turning immersive mode mode off. "); } else { Log.i(TAG, "Turning immersive mode mode on."); } // Navigation bar hiding: Backwards compatible to ICS. if (Build.VERSION.SDK_INT >= 14) { newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } // Status bar hiding: Backwards compatible to Jellybean if (Build.VERSION.SDK_INT >= 16) { newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN; } // Immersive mode: Backward compatible to KitKat. // Note that this flag doesn't do anything by itself, it only augments the behavior // of HIDE_NAVIGATION and FLAG_FULLSCREEN. For the purposes of this sample // all three flags are being toggled together. // Note that there are two immersive mode UI flags, one of which is referred to as "sticky". // Sticky immersive mode differs in that it makes the navigation and status bars // semi-transparent, and the UI flag does not get cleared when the user interacts with // the screen. if (Build.VERSION.SDK_INT >= 18) { newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } getActivity().getWindow().getDecorView().setSystemUiVisibility(newUiOptions); } ```