I am trying to customize the material design theme as suggested in this link : android dev
but when I add the following code to my v21/styles file Intellij says that it cannot resolve these symbols.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- customize the color palette -->
<item name="colorPrimary">@color/material_blue_500</item>
<item name="colorPrimaryDark">@color/material_blue_700</item>
<item name="colorAccent">@color/material_green_A200</item>
</style>
</resources>
I looked around to see if there are any particular settings that need to be done on the color side but nothing came up. I am using API 21 with support lib v7 on gradle.
@color/material_blue_500
and others are not the resources in android library.
You must define the color resources in res/values/colors.xml
by yourself.
such as <color name="material_blue_500">#5677fc</color>
.
And then you can use it as <item name="colorPrimary">@color/material_blue_500</item>
.
Android docs are very vague on this, leading to confusion. To get the predefined colors copy color_material.xml to your local res/values dir. That file is a preserved version as it was during Android-L. The offical version which sits in your local directory:
...sdk/platforms/android-21/data/res/values/colors_material.xml
has been trimmed down to remove those color definitions.
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