Make Xamarin Forms for Android Fullscreen

Anyway, to get the Xamarin Forms app on Android in full screen or immersed?

I tried the following and all the controls in 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.

+5
source share
2 answers

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

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

Alternatively, if you are only after a specific action is full-screen, then set the following flags in the OnCreate property:

 this.Window.AddFlags(WindowManagerFlags.Fullscreen); this.Window.ClearFlags(WindowManagerFlags.Fullscreen); 
+8
source
 protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our game view from the layout resource, // and attach the view created event to it CCGameView gameView = (CCGameView)FindViewById(Resource.Id.GameView); gameView.ViewCreated += LoadGame; gameView.SystemUiVisibility = (StatusBarVisibility)(SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.LayoutFullscreen | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.Immersive); } 
0
source

Source: https://habr.com/ru/post/1241018/


All Articles