Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full Screen without navigation & status bars

I want to create a activity with full screen. Nothing on above like Notification Bar and nothing below like Home-Button etc.I am able to get this, but also wanted to remove below home-button bar:

enter image description here

This is my code.

    <style name="MyScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>
like image 483
Muhammad Hasnain Avatar asked Apr 13 '17 10:04

Muhammad Hasnain


People also ask

How do I get rid of the navigation bar in full screen?

The navigation bar is pinned by default. If you want to view files or use apps in full screen, double-tap the Show and hide button to hide the navigation bar. To show the navigation bar again, drag upwards from the bottom of the screen.

What is immersive full screen?

Immersive Mode, also known as full screen mode on Android, hides the status and navigation bars while using certain apps. Immersive Mode on Android is only enabled in certain apps by default, but there are ways to turn full screen mode on and off at will without rooting your device.


1 Answers

What you need is called Immersive Full-Screen Mode.

enter image description here

// This snippet hides the system bars.
private void hideSystemUI() {
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    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);
}

// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
    mDecorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
like image 109
azizbekian Avatar answered Oct 12 '22 11:10

azizbekian