android – How to remove button bar at the bottom screen-ThrowExceptions

Exception or error:

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 ?
enter image description here

How to solve:

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.

###

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”.

###

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.

###

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.

###

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);
}

###

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,

http://www.42gears.com/blog/2013/07/disablehide-android-bottom-bar-without-rooting-samsung-galaxy-tablets/

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/

###

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)

###

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+.

###

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);}
}

###

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.

Leave a Reply

Your email address will not be published. Required fields are marked *