How to hide the System Ui in Android API 30

203 Views Asked by At

I've recently updated my targetSDK to 30. In this API setSystemUiVisibility is marked as deprecated, despite Android still recommending it (see here).

How can I go to sticky immersive Fullscreen in this API?

My code before updating:

private void hideSystemUI() {
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
            View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
            View.SYSTEM_UI_FLAG_FULLSCREEN);
}
0

There are 0 best solutions below