Make Xamarin Forms for Android Fullscreen

PaulusHub picture PaulusHub · Jan 20, 2016 · Viewed 11.8k times · Source

Is there anyway to get my Xamarin Forms application on Android go fullscreen or immersive mode?

I tried the following, and all the controls on the status bar are hidden but the status bar itself is still showing. Any help, please

var newUiOptions = (int)SystemUiFlags.LayoutStable;

newUiOptions |= (int)SystemUiFlags.LayoutHideNavigation;
newUiOptions |= (int)SystemUiFlags.LayoutFullscreen;
newUiOptions |= (int)SystemUiFlags.HideNavigation;
newUiOptions |= (int)SystemUiFlags.Fullscreen;
newUiOptions |= (int)SystemUiFlags.Immersive;
//newUiOptions |= (int)SystemUiFlags.ImmersiveSticky;

decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

The navigation bar is hidden but not the status bar.

Answer

KidCode picture KidCode · Jan 22, 2016

You can do this by setting the theme in the Activity attribute:

[Activity (Label = "@string/app_name", MainLauncher = true, Theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen")]

Alternatively, if your only after a specific Activity being fullscreen, then set the following flags in the activities OnCreate method:

this.Window.AddFlags(WindowManagerFlags.Fullscreen);
this.Window.ClearFlags(WindowManagerFlags.Fullscreen);