For a project the bottom navigation bar in an android app needs to be not visible. Found this code on browsing around and it works initially: This is some code in MainActivity.cs
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
HideNavAndStatusBar();
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
private void HideNavAndStatusBar()
{
int uiOptions = (int)Window.DecorView.SystemUiVisibility;
uiOptions |= (int)SystemUiFlags.LowProfile;
uiOptions |= (int)SystemUiFlags.Fullscreen;
uiOptions |= (int)SystemUiFlags.HideNavigation;
uiOptions |= (int)SystemUiFlags.ImmersiveSticky;
Window.DecorView.SystemUiVisibility = (StatusBarVisibility)uiOptions;
}
This code works until the on screen keyboard comes up when tapping on an entry. This shows the navigation bar again and it stays on even when the keyboard is closed. Similarly when a picker is tapped, the navigation bar pops up as well, when the picker window is closed the navigation bar is gone again.
This code will be used for an internal system and it is very important that the user can not go and mess around on the android os.
Any ideas on how to fix this?