0

I would like to use the Immersive Full-Screen Mode in my app.

I have no problem entering the mode, but when I start the next Activity it is gone. I fixed this by creating my own Activity-class which extends AppCompatActivity and overloads onCreate(...) with

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

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

All my other Activities now extend this class. Is there a better way to do this?

liquid.pizza
  • 505
  • 1
  • 10
  • 26
  • Do you want to hide title if so go to this link http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme – Misbah Farooqi Apr 06 '16 at 17:21

1 Answers1

0

Setting the flags that you are using (less View.SYSTEM_UI_FLAG_LAYOUT_STABLE) the bars begins to hide and show dynamically. Now you must set this behavior in the method onResume.

If you need add any behavior to this functionality go to this link:

https://developer.android.com/training/system-ui/visibility.html

Ian
  • 1
  • 2