Reputation: 33071
I created an app in Android Studio using the Empty Activity template. This template contains a very simple Activity with a layout that just has a TextView. One of the things it includes is a styles.xml / colors.xml that defines a simple theme:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
According to the Material Theme specification, colorPrimaryDark will change the status bar color on Lollipop devices. I created a Xamarin project with the exact contents of all of these files. The status bar remained black.
What am I doing wrong? This works perfectly fine in Android Studio.
Upvotes: 2
Views: 694
Reputation: 33071
I found the issue. In the project properties I had the following initially:
Compile using Android version: Use Latest Platform (Android 6.0 (Marshmallow))
Minimum Android to target: Android 4.4 (API Level 19 - Kit Kat)
Target Android version: Use Compile using SDK version
I changed it to:
Compile using Android version: Use Latest Platform (Android 6.0 (Marshmallow))
Minimum Android to target: Android 4.4 (API Level 19 - Kit Kat)
Target Android version: Android 6.0 (API Level 23 - Marshmallow)
Target Android version on Compile Using SDK Version needed to be changed to a specific API level.
Upvotes: 4