Android Fullscreen not working properly

graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true;

The code doesn’t hide the navigation bar. Any solution to this?

1 Like

Are you doing this in your Game constructor? If not I think you should call graphics.ApplyChanges().
I’m not sure though.

Yes I am. Even the default template created for Android using VS2015 doesn’t hide the navigation bar on the bottom when IsFullScreen is set to true.

What model device and which Android version?

@KonajuGames Nexus 4 on Android 5.1.1

I’m facing same issue, graphics.IsFullScreen = true hides status bar but navigation bar is still visible. Any solution or workaround for this ? Reproduced with Nexus 5 on Android Marshmallow.

Is it really possible to hide the navigation bar on Android? How do you exit the app on a device that has no physical buttons if you hide the navigation bar?

Yes, it’s possible on Android. Please take a look:

The user can reveal the system bars with an inward swipe along the region where the system bars normally appear.

Same stuff applies for navigation bar, just launch any game on Android and you will se how it works. Anyhow, any suggestions how to make it work ?
Mono Droid provides within Activity property

this.Window.DecorView.SystemUiVisibility

but I think all I can do with this is set to SystemUiVisibility.VISIBLE or SystemUiVisibility.HIDDEN. Well, this is basic equipment for any Android game. How to solve this with Monogame ?

This used to work. We will have to investigate.

I also suffered this issue…
I am using the following code into Activity1.
It seems to be work :slight_smile:

  protected override void OnCreate(Bundle bundle)
  {
    base.OnCreate(bundle);
    var g = new Game1();
    SetContentView((View)g.Services.GetService(typeof(View)));
    g.Run();

    View vw = (View)g.Services.GetService(typeof(View));
    vw.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation | (StatusBarVisibility)SystemUiFlags.ImmersiveSticky;
    vw.SetOnSystemUiVisibilityChangeListener(new MyUiVisibilityChangeListener(vw));
  }
  private class MyUiVisibilityChangeListener : Java.Lang.Object, View.IOnSystemUiVisibilityChangeListener
 {
    View targetView;
    public MyUiVisibilityChangeListener(View v)
    {
      targetView = v;
    }
    public void OnSystemUiVisibilityChange(StatusBarVisibility v)
    {
      if (targetView.SystemUiVisibility != ((StatusBarVisibility)SystemUiFlags.HideNavigation | (StatusBarVisibility)SystemUiFlags.Immersive))
      {
        targetView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation | (StatusBarVisibility)SystemUiFlags.ImmersiveSticky;
      }
    }
}

Works for me also, thanks. You could simplify it a little and to be more consistent with Android documentation, you could use

this.Window.DecorView.SystemUiVisibility

instead of fetching view from service. Anyhow, it’s strange that we have to cast SystemUiFlags to StatusBarVisibility

SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation

Thanks! I also tried it.

this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation;

On my environment(android 5.1.1), once the navigation bar is displayed, it will not hide automatically.
Is there no problem in your environment?

It hides automatically, both status and navigation bars. Verified on Nexus 5 with Android Marshmallow. I’m using 2 flags to handle that, not only HideNavigation but also ImmersiveStick. Please take a look on code:

        onCreate(...)
        {
            this.Window.DecorView.SetOnSystemUiVisibilityChangeListener(this);
            HideSystemUI();
        }

        public void OnSystemUiVisibilityChange(StatusBarVisibility visibility)
        {
            HideSystemUI();
        }

        private void HideSystemUI()
        {
            SystemUiFlags flags = SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky;
            this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)flags;
        }

works like a charm :slight_smile: EDIT: even 3 flags, but I think SystemUiFlags.Fullscreen is redundant if you use Game.IsFullScreeen = true property

1 Like

I dit it. Thanks a lot !

Thanks a lot.aaaaaaaaa