How to permanently hide navigation bar in android application? - android

I have a problem hiding navigation bar at the bottom of the screen in android.
Every solution I've tried doesn't work exactly as I want it to work, except one.
Modifying build.prop with new entry 'qemu.hw.mainkeys=1' worked ok, but it disables navigation bar for whole android system.
Is there possibility to disable navigation bar like this only for one app?

Try this:
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
(Source)

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
Use this code in onCreate(), it will hide status bar and navigation bar until users swipe down from top of the screen

Related

How, Android Bottom Navigation Bar hide permanently or disable

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.

Android immersive mode for dropdown, hide navigation Bar

added listview to PopupWindow object, on click Navigation key bar is popping, is there is a way to block navigation bar on click of dropdown.
try this snippet inside on onclick of drop down item
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
and refer here and here

How to prevent status bar from showing in fullscreen mode on click

I use the code below to enable fullscreen mode:
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
);
At android 5 all is ok, but at android 4.3 status bar (and nav bar) are opened afrer 'click' action on any button, so I need to tap twice.
How to prevent this control from showing on onClick?
Simply add
android:theme="#android:style/Theme.Light.NoTitleBar.Fullscreen"
in your manifest.

How to hide the navigation bar in android?

so i'm writing an app in which i would like the navigation bar in a specific
activity to be hidden...and i managed to do so...but my problem is when the
user scrolls down the notification bar...when that happens...the navigation bar
re-appears...how can i solve this problem?
final int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN;
//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
when the user scrolls down the notification bar...when that happens...the navigation bar re-appears
I think this behavior is normal and intended as UI design of Android.
Whenever a user swipes-down upper edge or swipes-up bottom edge of screen, both system bar and navigation bar re-appear. Then after a few seconds, they are both disappear again. So as to the user can access system bar or navigation bar whenever they want even if screen is in immersive mode.
can i do anything to disable this? or maybe only hide it
No, generally (without root access) you can't. Only you can do is to hide it. Please refer to these StackOverflow Q&As: Permanently hide navigation bar on activity; Hide System Bar in Tablets.

How to hide navigation bar when i press action bar menu in Android

I hide the navigation bar (see below) but when I press the menu button on action bar the navigation bar immediately appear.
Can I hide nav. bar permanently?
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
setContentView(R.layout.activity_fomenu);
}
Take a look at the documentation. It says to hide the navigation use
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
You're already doing that. But then it says
With this approach, touching anywhere on the screen causes the navigation bar (and status bar) to reappear and remain visible. The user interaction causes the flags to be be cleared. Once the flags have been cleared, your app needs to reset them if you want to hide the bars again. See Responding to UI Visibility Changes for a discussion of how to listen for UI visibility changes so that your app can respond accordingly.
This means that you will have to reset the flags when the user selects the options menu. A sample code is also given here.

Categories

Resources