Reputation: 1243
I am building custom image.I going through android source, i want to get rid off bottom softkey button bar in android, Can some one please direct me to source file to change ?
Upvotes: 31
Views: 71859
Reputation: 91
for API 32 android studio emulator you can change "Gesture Navigation" to "3 Button Navigation" or "2 Button Navigation", because it's sometimes has problems with scrolling drawerLayout
Settings -> System -> Gestures -> System Navigation
Upvotes: 4
Reputation: 2869
Just change hw.mainKeys to yes in config.ini file.
1- Open config.ini file (To find file in your system follow steps below).
2- Don't forget to restart your emulator.
Upvotes: 1
Reputation: 152
For lvl 30
window.decorView.windowInsetsController?.hide(android.view.WindowInsets.Type.statusBars())
Below 30
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
Upvotes: 0
Reputation: 201
Is there a way to stretch the controls to the bottom of the screen if I hide my navigation bar? I have an ImageView with the height set to match_parent but the absent navigation bar leaves a black rectangle.
Upvotes: 0
Reputation: 2326
The easiest way to take a screen shot without the bottom navigation bar is to use an emulator (AVD) and edit its config file.
Go to .android/avd/virtual-device.avd
Then edit the config.ini:
hw.mainKeys=yes
hw.keyboard=yes
Both should be set to "yes"
In order to be able to see the bar again, set them back to "no".
Upvotes: 19
Reputation: 13302
Yes you can by using this in your activity :
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
decorView.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);}
}
Upvotes: 0
Reputation: 136
In addition to Aykut Burak SAFAK's answer above, you can put his code in onWindowFocusChanged
event to make sure that whenever the Activity
gets focus (e.g. after unlocking) it retains fullscreen without soft keys state.
@Override
public void onWindowFocusChanged(boolean hasFocus){
super.onWindowFocusChanged(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);
}
Upvotes: 6
Reputation: 332
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);
use this code in onCreate. But this requires api lv over 19.
Upvotes: 9
Reputation: 731
If you only want to make the navigation bar (the button bar) less distracting, try youractivity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE)
Upvotes: 1
Reputation: 8251
With introduction of new SureLock for Samsung, Bottom Bar can be disabled or hidden without rooting of the device. All you have to do is to install SureLock Lockdown for Samsung and follow procedures mentioned in the following site,
Check out the following link.It may help you understanding it.
http://www.42gears.com/blog/2012/02/disable-bottom-bar-in-android-honeycomb-tablets-with-surelock/
Upvotes: 3
Reputation: 888
I think this is possible
To hide the softkey Try getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
but it is not working on tablet 4+.
Upvotes: 0
Reputation: 1058
You cannot hide it permanently, however:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
this code hides the soft keys until the user interacts with your app. This is intentionally designed this way, just imagine, you don't provide any mean to exit from the current screen and hide theese keys, the user would be "trapped" in a one-way dead end.
You can find more here.
Upvotes: 8
Reputation: 2011
To enable / disable them, as far as I know you simply have to edit the build.prop:
qemu.hw.mainkeys=0 (show on screen buttons)
or
qemu.hw.mainkeys=1 (disable on screen buttons)
If the line does not exist in your build.prop, add it at the bottom.
Upvotes: 32