Search code examples
androidandroid-5.0-lollipopmaterial-design

Android L Change Theme Colors Error


I've been following the new steps for Android L here: http://developer.android.com/preview/material/theme.html I've have been trying to change the colors of the status bar but it doesn't work.

My styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:style/Theme.Material.Light">
<!-- Main theme colors -->
<!--   your apps branding color (for the app bar) -->
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorPrimary">@color/primary</item>
<!--   darker variant of colorPrimary (for status bar, contextual app bars) -->
<!--   theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/accent</item>
</style>
</resources>

My colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#03a9f4</color>
<color name="primary_dark">#0091ea</color>
<color name="accent">#e1f5fe</color>
</resources>

Solution

  • I have the same problem. And I fix this by change sdk to

    <uses-sdk android:minSdkVersion="L" android:targetSdkVersion="L" />
    

    Hope it can help.