I'm trying to change Navigation Bar and Status Bar background color in my .Net MAUI Android App.
I found how to do that when the app has initialized an loaded (Status Bar: Using MauiCommunityToolkit StatusBarBehavior StatusBarColor feature. Navigation Bar: Using Window.SetNavigationBarColor).
But I have not found how to do that when the app starts and shows the Splash Screen. I need black background color for both, Status and Navigation bar but when the App starts, NavBar is white and Status Bar is Purple (default .Net MAUI color). I attached an image of how it looks when starts.
I tried changing the Primary Color in the Resources/colors.xml, and it didn't work.
My App is a MAUI Single project template (Android and iOS).
Thanks in advance for taking a look at this issue.
UPDATE: I was able to change just Status Bar, changing defautl colorPrimaryDark value in Platforms/Android/Resources/colors.xml
You can create a new .xml file and then put the style in or add the style to colors.xml directly:
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
<style name="SplashTheme" parent="@style/Maui.SplashTheme">
<item name="android:statusBarColor">@android:color/black</item>
<item name="android:navigationBarColor">@android:color/black</item>
</style>
</resources>
In the MainActivity.cs file (Platforms/Android):
[Activity(
//Theme = "@style/Maui.SplashTheme",
Theme = "@style/SplashTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
public class MainActivity : MauiAppCompatActivity
It works well and can achieve your need.