How to Hide The Soft-Key Bar on Android Phone

How to hide the soft-key bar on Android phone?

Try

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

From official doc

The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN
flag. When set, this flag enables “low profile" mode for the system
bar or navigation bar. Navigation buttons dim and other elements in
the system bar also hide. Enabling this is useful for creating more
immersive games without distraction for the system navigation buttons.

The SYSTEM_UI_FLAG_VISIBLE flag replaces the STATUS_BAR_VISIBLE flag
to request the system bar or navigation bar be visible.

The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag that requests the
navigation bar hide completely. Be aware that this works only for the
navigation bar used by some handsets (it does not hide the system
bar on tablets). The navigation bar returns to view as soon as the
system receives user input. As such, this mode is useful primarily for
video playback or other cases in which the whole screen is needed but
user input is not required.

The behavior of the nav bar is app dependent IIRC, so it should show again after the user leaves your app.

How to hide the soft navigation bar(virtual buttons) of android device for whole application?

Immersive flag for setSystemUiVisibility() lets your app go truly "full screen." Link

Try below code, for immersive mode.

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
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);
}
}

Hide/show bottom navigation soft keys

please refer this answer of damian

in build.prop

 qemu.hw.mainkeys=0 (show on screen buttons)
or

qemu.hw.mainkeys=1 (disable on screen buttons)


Related Topics



Leave a reply



Submit