I always get the error "No Resource found that matches the given name" in my themes.xml file no matter which resource I use or in which I use it. Even if the resource works everywhere else.
Here's some code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="Theme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
<item name="android:actionOverflowButtonStyle">@style/ActionBarOverflowStyle</item>
</style>
<!-- ActionBar styles -->
<style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#008A3D</item>
</style>
<style name="ActionBarOverflowStyle" parent="@android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">@drawable/OverflowIcon</item>
</style>
<!--Dialog styles-->
<style name="DialogStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#008A3D</item>
</style>
</resources>
I deleted the item node to check whether I can use the resource in code. Proof that it worked; No error:
After googling and fiddling around for a few more hours I figured out that the problem was due to the fact that I use uppercase characters in the file name which works fine everywhere else. This is either a terrible behavior of Android or a bug in Xamarin.
For anyone else that finds this question for different reasons:
Whenever I Copy or Rename a drawable resource in VS 2017, it changes the 'Build Action'.
Double check your resources, and ensure the Build Action is set correctly. In my case, it needed to be 'AndroidResource'
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