Reputation: 15078
I have given manually value to item in styles.xml
it is looking like below
<item name="middleBarArrowSize">16.0dip</item>
<item name="topBottomBarArrowSize">11.309998dip</item>
<item name="disableChildrenWhenDisabled">true</item>
also in some places
<item name="cardBackgroundColor">@color/cardview_light_background</item>
<item name="cardBackgroundColor">@color/cardview_light_background</item>
but in colors.xml I have declared value like
<color name="cardview_dark_background">#ff202020</color>
<color name="cardview_light_background">#fffafafa</color>
<color name="cardview_shadow_end_color">#03000000</color>
<color name="cardview_shadow_start_color">#37000000</color>
<color name="common_action_bar_splitter">#ffd2d2d2</color>
screenshot is like below
I have searched many site
No resource found that matches the given name: attr 'homeHint'
No resource found that matches the given name: attr 'colorPrimary'
No resource found that matches the given name: attr 'android:tabLayout'
Execution failed app:processDebugResources Android Studio
but no on eis helpful for me
will any one suggest me why i am getting this error and what is the solution for this
Upvotes: 0
Views: 3435
Reputation: 626
In case some resource not found for example
compile "com.android.support:cardview-v7:23.2.0"
At this time first you check values-v24
and your build.gradle
dependencies {
compile "com.android.support:support-v4:24.2.0"
compile "com.android.support:support-v13:24.2.0"
compile "com.android.support:cardview-v7:24.2.0"
}
If your file name version and dependencies api
version same then you can resolve this type of error easily.
For example
com.android.support:cardview-v7:24.2.0
is OK for values-v24
res folder
Upvotes: 1
Reputation: 45493
The reason why this works:
<item name="cardBackgroundColor">@color/cardview_light_background</item>
But this doesn't:
<item name="middleBarArrowSize">16.0dip</item>
Is because cardBackgroundColor
is declared in the android.support.v7.cardview
package, which your project will have a dependency on. This can easily be confirmed if you open up:
<sdk_path>/extras/android/support/v7/cardview/res/values/attrs.xml
Amongst others, you'll find:
<resources>
<declare-styleable name="CardView">
<!-- Background color for CardView. -->
<attr name="cardBackgroundColor" format="color" />
...
</declare-styleable>
</resources>
Based on the code you've given, middleBarArrowSize
hasn't been declared anywhere yet. In order to use a custom attribute, you have to declare it first (similar to above).
This process is explained in the docs here and will result in something like this:
res/values/attrs.xml
<resources>
<declare-styleable name="MyCustomAttributes">
<attr name="middleBarArrowSize" format="dimension" />
<attr name="topBottomBarArrowSize" format="dimension" />
<attr name="disableChildrenWhenDisabled" format="boolean" />
<!-- add more here -->
</declare-styleable>
</resources>
After having done that, you should be able to use the declared attributes in your project.
but in colors.xml I have declared value like (...)
There is a difference between attributes and colors. A color is a value, whereas an attribute is something you can assign a value to (i.e. a color, or a string, etc).
Upvotes: 1