Hide android system bar (SOLVED)

In Defold, can I hide the system bar of android?The system bar is the bar in the bottom of screen that include back、home、and multitask:


I try to invoke the following code in java, but It crashed.

@SuppressLint(“NewApi”)
public static String hideNavigationBar(Context ctx, String params)
{
if(Build.VERSION.SDK_INT >= 19)
{
Activity act = (Activity)ctx;
Window window = act.getWindow();
View view = window.getDecorView();
int visibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
view.setSystemUiVisibility(visibility);
}
return “”;
}

I found that it crashed in view.setSystemUiVisibility(visibility);

Did you tried with the Immersive Mode checked in your game.project?

2 Likes

OK,I’ll have a try.

Yeah, that’s why I remember it:

For me it was working :wink:

It works,Thank you.

2 Likes