I have enabled Material theme on my Xamarin.Forms project with the following code, but on Android (Lollipop and Marshmallow) the top status bar (where the clock, signal, battery, etc.. are located) doesn't change. It remains always black. I've already read lot of forums and blogs, tried lot of combination but I'm not able to get this status bar colored as I want.
MainActivity.cs
[Activity(Theme = "@style/MyTheme", Label = "MyApp", Icon = "@drawable/AppIcon", ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
values-v21/style.xml
<resources>
<style name="MyTheme.Splash" parent="android:Theme.Material.Light">
<item name="android:windowBackground">@drawable/SplashScreen</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MyTheme" parent="android:Theme.Material.Light">
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:colorPrimary">@color/Brand</item>
<item name="android:textColorPrimary">@color/White</item>
<item name="android:statusBarColor">@color/BrandDark</item>
<item name="android:colorPrimaryDark">@color/BrandDark</item>
<item name="android:colorAccent">@color/Brand</item>
<item name="android:textColor">@color/Brand</item>
</style>
</resources>
values/colors.xml
<resources>
<color name="SplashBackground">#f78b2b</color>
<color name="Brand">#f78b2b</color>
<color name="BrandDark">#e47108</color>
<color name="White">#ffffff</color>
</resources>
Thanks for any help!
You should follow this Tutorial to get success.
Basically you have to use FormsAppCompatActivity
instead of FormsApplicationActivity
and Theme.AppCompat.Light.NoActionBar
instead of Theme.Material.Light
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With