I am working on custom screen lock app where we need to full screen view hiding the top and bottom bars completely. The app is for Android phones only and not tablets. I achieved this partially by using Immersive mode but the issue is the bottom bar & top appears for few seconds on touching bottom or top of the screen.
Below is the code in my activity to do this :
final int flags = 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;
getWindow().getDecorView().setSystemUiVisibility(flags);
I have tried various options but unable to hide the bars permanently. Please advise.
Related
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.
my requirement(security purpose) is when user log into my app he is not allow to
close app
navigate to another app
not allow to change setting
so to fulfilled this requirement i want to
Hide Bottom navigation Bar (or)
disable Bottom navigation bar
i try to hide bottom navigation bar using this code
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION ;
decorView.setSystemUiVisibility(uiOptions);
but when i touch screen again Bottom navigation reappear
This is banking app banking people requesting to do that if there any possibility
do this task or if you have any other solution please give me
It can not be permanently hidden- it would be android security issue
Try this:
View decor_View = getWindow().getDecorView();
int ui_Options = 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;
decor_View.setSystemUiVisibility(ui_Options);
But it need device android OS version is 4.4 or higher.
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.
I am trying to expand a VideoView to full screen and horizontal mode whenever a 'full-screen' button is clicked, but I cannot find a way to expand the view completely over the whole screen. I have a toolbar and a tabbed layout I can't find a way to bypass both of them and apply the view over them. Anybody has ideas how I can achieve this?
Without code I am not sure of your layout but, translate your TabLayout out of the way and go to 'immersive' mode to hide all system bars. You can use the following method:
private void hideSystemUI() {
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
getWindow().getDecorView().setFitsSystemWindows(false);
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 // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}
To come out of immersive mode, just use the following method:
private void showSystemUI() {
getWindow().getDecorView().setFitsSystemWindows(true);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
In the list of the paused apps, Android usually shows a small preview image of the app.
However, the preview image is black when I use the following way to hide the navigation bar:
uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(uiOptions);
If I remove the last two options, the preview is shown correctly. Keep one and the preview is black.
Is this a bug or are there any reasons for this? Are there any workarounds?
Edit: I would like too add that I also see this behaviour on other games that hide the navigation bar, like Plants vs. Zoombies 2....but that could be on purpose.