Android MonoDroid-从colors.xml设置背景色引发InvalidOperationException
我有一个简单的布局如下:Android MonoDroid-从colors.xml设置背景色引发InvalidOperationException,android,exception,colors,embedded-resource,xamarin.android,Android,Exception,Colors,Embedded Resource,Xamarin.android,我有一个简单的布局如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/widget30" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/translucent_red" android:orientation="
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/translucent_red"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="opaque_red">#f00</color>
<color name="translucent_red">#80ff0000</color>
</resources>
一切正常
有人知道MonoDroid是否支持colors.xml吗?如果支持,为什么会出现这个错误
谢谢你的帮助 解决了这个问题,colors.xml的构建操作被设置为Content而不是AndroidResource 很好,你发现了这一点。另一个需要考虑的问题是,您总是使用小写字母定义颜色id。我使用大写字母,虽然我的c#代码通过区分大小写的搜索来查找资源,但android在引用可绘制或布局xml文件时需要小写id(这里使用@color/the#id)
android:background="#80ff0000"