Hiding the navigation bar on Android

Is there a way to hide the navigation bar on Android though CocosSharp? I'd like the application to be truly full screen.

Thanks!

Posts

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Vance,

    Yep, within your MainActivity you could do something like the following

    
        public class MainActivity : AndroidGameActivity
        {
            protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
    
                View decorView = Window.DecorView;
                var uiOptions = (int)decorView.SystemUiVisibility;
                var newUiOptions = (int)uiOptions;
    
                newUiOptions |= (int)SystemUiFlags.LowProfile;
                newUiOptions |= (int)SystemUiFlags.Fullscreen;
                newUiOptions |= (int)SystemUiFlags.HideNavigation;
                newUiOptions |= (int)SystemUiFlags.Immersive;
    
                decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
    
                var application = new CCApplication();
                application.ApplicationDelegate = new GameAppDelegate();
                SetContentView(application.AndroidContentView);
                application.StartGame();
            }
        }
    
    

    Just keep in mind that Immersive mode is only supported on Android 4.4 (KitKat) and later.

  • VanceSoudersVanceSouders USUniversity

    Rami,

    Thanks! That's exactly what I was looking for.

    -Vance

Sign In or Register to comment.