I've developed a small Xamarin.Forms.Shell app and I didn't found how to apply a custom color for the StatusBar
Foreground and Background.
My app use a very basic color scheme:
- black for the Foreground of the
NavigationBar
and theTabBar
- white for the Background of the
NavigationBar
and theTabBar
I would like to keep the same colors for the StatusBar
, but it's not the case:
- on iOS, the
StatusBar
color seems to be managed by the LightMode/DarkMode
=> on devices that doesn't manage DarkMode, or when LightMode is active, the StatusBar
informations are well displayed
=> but it's not the case when the DarkMode is active, as these informations are hidden
- on Android, the
StatusBar
color seems to be managed by thestyles.xaml
file and theandroid:statusBarColor
property
=> if I specify a white color, the StatusBar
informations are not visible as there are also white
=> whereas if I specify a gray color, the StatusBar
informations are well visible
So I've tried to apply a solution given there:
- this doens't work on iOS: I still have the same behavior, as the
StatusBar
informations are not visible as there are also white when DarkMode is active - this seems to work on Android, but this doesn't cover all Android versions (as it works from Marshmallow version)
=> How could I manage the iOS StatusBar Foreground color? Is it enough for Android?
you can use the following method for iOS (white status bar with black texts)
Check my question/answer
Xamarin Forms - how to change the status bar color without a navigation page
The full working sample is here https://github.com/georgemichailou/ShaXam