Search code examples
androidhtc-android

Android SDK - Hide HTC Sidebar


The HTC sidebar with the software buttons is not good for the aspect ratio. How do I hide it?

I am already using:

<preference name="Fullscreen" value="true" />

And this hides the top menu bars on Samsung devices, but not the sidebar on HTC devices.


Solution

  • It's with a Home icon, Back icon and some other icon. When the device is in landscape mode, this side bar is on the right so you can get into the main menu again or exit the app.

    That is called the navigation bar. It exists on about half of the world's Android devices, specifically those that do not have off-screen keys for HOME and BACK.

    Quoting the documentation:

    You can hide the navigation bar on Android 4.0 and higher using the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag.

    The documentation also shows a code snippet of how to use it:

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