Saturday 29 October 2022

Unable to change the StatusBar when at the splashscreen for light and dark themes

I am trying to change the color/style of the StatusBar based on the device being set to light or dark theme, but not having much luck.

The following XAML works once the app has loaded, but does not work on the splash screen:

<ContentPage.Behaviors>
    <toolkit:StatusBarBehavior StatusBarColor="#F8F9FB" StatusBarStyle="DarkContent"  />
</ContentPage.Behaviors>

Look of StatusBar during splashscreen: enter image description here

Look of StatusBar once app has loaded: enter image description here

As you can see, the XAML above does not seem to affect the StatusBar during the splashscreen, as it is still showing it's default purple color with white text. Any idea how to change the StatusBar while the app is showing the splashscreen?

The end goal is the set the statusbar color and icon colors accordingly based on the device being set to light or dark theme. For example, if the device is set to use the dark theme, the statusbar while showing the splashscreen and the app shell should be a dark background with light text/icons. When the device is set to use the light theme, the statusbar while showing the splashscreen and the app shell should be a light background with dark text/icons.

I have checked many many existing questions about this, but they all seem to be obsolete, as I am using API 33.



from Unable to change the StatusBar when at the splashscreen for light and dark themes

No comments:

Post a Comment