Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using immersive mode on LibGDX

Tags:

android

libgdx

I have a portrait screen and want to use immersive mode (not sticky immersive). Also LibGDX has immersive feature:

 AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
 config.useImmersiveMode = true;

But useImmsersive is a sticky immersive.

like image 617
Matt Avatar asked Aug 22 '15 09:08

Matt


1 Answers

Instead of using useImmersive override onWindowFocusChanged in your AndroidLauncher class

 @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus && Build.VERSION.SDK_INT >= 19) {
            getWindows().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);
        }
    }
like image 174
Saeed Masoumi Avatar answered Nov 04 '22 15:11

Saeed Masoumi