user5313398
user5313398

Reputation: 753

Xamarin No resource found that matches the given name (at 'colorAccent' with value '@color/accent ')

I am setting new xamarin forms. So for the android I am trying to set material design. Initially I had issue to park the styles.xml all that have been resolved. I have checked via the nuget that this xamarin.android.support.design and also xamarin.support.v7.Appcompat is already installed and up to date. What could else could go wrong or I did not set ?

Here is my styles.xml file.

<?xml version="1.0" encoding="UTF-8" ? >
<resources>
    <style name="DesignTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle" >true </item >
        <item name="windowActionBar" >false </item >
        <item name="colorPrimary" >@color/primary </item >
        <item name="colorPrimaryDark" >@color/primary_dark </item >
        <item name="colorAccent" >@color/accent </item > 
    </style >
</resources >

Upvotes: 0

Views: 587

Answers (1)

Gerald Versluis
Gerald Versluis

Reputation: 33993

Are you following some tutorial?

The @color/accent is a variable you have to define yourself. This can come in handy so that you do not have to go by every place in your XML where you used the color, but you only have to change the value in the @color/accent variable.

To fix it quickly you can replace the @color/accent with #666666 for instance.

If you want to use the variables part create a colors.xml file under the resources folder. In these specify something like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="accent">#666666</color>
</resources>

Now the @color/accent should be available. Of course instead of accent you can use any other name as well as you like.

Upvotes: 1

Related Questions