Customize Android Status & Navigation Bar Colors in MAUI

Learn to customize the Android status and navigation bar colors in .NET MAUI. This guide covers modifying `colors.xml` and your app's native theme.

  1. Add a style in the colors.xml file.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    <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>
    
  2. Modify the theme in the MainActivity.cs file (Platforms/Android).

    1
    2
    3
    4
    5
    
    [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
    
Built with Hugo
Theme Stack designed by Jimmy