Hello @Olivier Manso ,
Native Android only allows the text in the status banner to be grey or white.
For Android 11 or later, you can open your MainActivity.cs
under Platform->Android, then override OnCreate
method , and find the window to set SystemBarsAppearance. For Android 6 to android 10, please use set SystemUiVisibility to change it. In addition, you can set StatusBarColor so that the items on the bar can be read clearly.
protected override void OnCreate(Bundle savedInstanceState)
{ ...
Window.SetStatusBarColor(Android.Graphics.Color.Cyan);// change the status bar color
if (Build.VERSION.SdkInt >= BuildVersionCodes.R)
{
Window.InsetsController?.SetSystemBarsAppearance((int)WindowInsetsControllerAppearance.LightStatusBars, (int)WindowInsetsControllerAppearance.LightStatusBars);
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.M && Build.VERSION.SdkInt < BuildVersionCodes.R)
{
Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar;
}
}
Or you can do this in MainPage
, please try using Microsoft.Maui.ApplicationModel
, and find the Window by Platform.CurrentActivity.Window
, then set SystemBarsAppearance
#if ANDROID
Platform.CurrentActivity.Window.SetStatusBarColor ....
Platform.CurrentActivity.Window.InsetsController?.SetSystemBarsAppearance...
#endif
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.