Forum Xamarin.Android

Toggle Android Statusbar with press of a button


I am trying to completely hide and show the statusbar on Android (toggle fullscreen) when I press a button.

What I am currently doing is

        public void ToggleFullscreen(bool isFullscreen)
            var window = MainActivity.window; // Gets set in OnCreate
            var fullscreenFlag = WindowManagerFlags.Fullscreen;

            if (isFullscreen)

I can get the clock and battery icons to disappear (With a pretty jumpy animation). But it still leaves a black space on the top and takes up as much space it did before.

Does anyone have a solution on how to completely hide/show the statusbar (i.e. Toggle fullscreen mode)?


  • LandLuLandLu Member, Xamarin Team Xamurai

    I tried your code on my side. However, it worked as expected:

    The content will occupy the space of the status bar.
    Could you please share a sample to help reproduce the issue?

  • DanielHJDanielHJ Member ✭✭

    Thank you for the answer LandLu!

    I'm afraid I cant share this project. But at least I know that it works for someone else, so there must be something else wrong in my project.

    Did you set any special parameters in your styles.xml file? I am currently using:


    But I have also tried with the FullScreen theme.

  • LandLuLandLu Member, Xamarin Team Xamurai

    I test this on a completely new project.
    You could have a try by creating a new project.
    Try to reproduce the issue on a basic sample. We don't need your whole project here.

Sign In or Register to comment.