Unable to show the action bar with SYSTEM_UI_FLAG_LAYOUT_STABLE - android

I am unable to show the action bar when SYSTEM_UI_FLAG_LAYOUT_STABLE is used as following:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
I use getSupportActionBar().show() and getSupportActionBar().hide() to show or hide the action bar. If SYSTEM_UI_FLAG_LAYOUT_STABLE is taken out from the above code, everything will be fine - the action bar can be shown or hid without any problem.
Could anyone shed some light on this?

Related

How to show ActionBar when exit full screen by swipe down?

mContext.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
I am using the above codes to hide enter the full screen mode. It can be exited by swiping back, top or bottom. However, the Action Bar remains hidden, while the status bar and navigation bar appears (Picture 2).
How can I bring up the ActionBar ? Or detecting the "Exit" (Picture 3) event listener so that I can call the following to show ActionBar?
mContext.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
Due to design requirement, I can't use the touch listener to bring up the ActionBar() in this case.

Strange behavior of fullscreen mode on Android 7.0

I have an application which will show fullscreen without problem on Android 4-6. But once test on Android 7.0, although the navigation and status bar are hide, the navigation bar position seems still occupied by a white bar. My application cannot automatically resize to occupy that space.
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I use the above code to do the fullscreen. Please advise. Thanks.

Navigation bar is not transparent in landscape mode over KitKat(4.4)

How do I make the navigation bar transparent in landscape?
It works in portrait.
My device version is Kitkat(Nexus5)
The Youtube Kids works in KitKat.
I solved this problem.
We cannot set a color to navigation bar in landscape under lollipop.
But we can set transpalent temporarily these version.
You set the flag which is View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY.
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 // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

Why is onMenuOpened is not called?

An app hides the action bar in the following way:
uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
//Hide both the status bar and navigation bar
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
When the screen is touched, the following method is called to show the action bar:
uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(uiOptions);
Everything works as expected except when the overflow menu is opened after the 3-dot is tapped, onMenuOpened of the activity is not called, but the menu is opened normally.
Could anyone shed some light on this?
Possibly this.
The reason that onMenuOpened() and onPanelClosed() are not called is
that Activity's default implementations of those methods will try and
init the framework Action Bar.

When Using Immersive Mode a line appears

I'm trying to use the immersive mode introduced in Android 4.4. I use this code to set the visibility and it works exactly how I want it to:
View decorView = getWindow().getDecorView();
int uiOptions = //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 // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
However, it puts a line on the display. I have a screenshot but cannot post it because this is my first question. I have no idea what it is or how to get rid of it. Can anyone help?

Categories

Resources