How do I remove the navigation bar from my Android

2019-07-23 10:18发布

问题:

Since the device I am developing has physical buttons, I do not want to see a navigation bar taking up my screen space. Rowboat-android on Beagleboneblack shows the navigation bar by default. Where do I turn it off?

EDIT: I am not developing applications. I am developing a Beaglebone based device. I want to remove the bar globally from the system. Somewhere there should be a code or setting in the Android source.

回答1:

Found the answer at Building a wireless Android device using BeagleBone Black

Basically I edited device/ti/beagleboneblack/overlay/frameworks/base/core/res/res/values/config.xml file to set this entry:

    <bool name="config_showNavigationBar">false</bool>


回答2:

You should use IMMERSIVE flag like this:

private void hideSystemUI() {
    mDecorView.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);
}

For more info, I recommend you to take a look at here.