VS Android 找不到资源

VS Android can't find resource

我对此有点陌生,我找不到解决这个问题的方法。我想使用在此处找到的自定义控件:https://github.com/amccorma/xamarin-amccorma/tree/master/Forms.DropDown

将所有文件放入我自己的项目后它告诉我找不到资源

错误:

Severity Code Description Project File Line Suppression State Error No resource found that matches the given name (at 'style' with value '@style/spinner_style'). xx.Droid C:\Users\xx\Documents\Visual Studio 2015\Projects\xx\xx\xx.Droid\Resources\layout\spinner.xml 2

在资源的 layour 文件夹中有一个 spinner.xml 文件,如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/Lspinner"
android:paddingLeft="5dp">
  <LinearLayout
  android:id="@+id/parentLayoutSpinner"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:showDividers="none">
<xx.Droid.CustomRenderers.DDPicker.MyAppCompatSpinner xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/spinner2"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:contextClickable="false"
    style="@style/spinner_style" />

编辑: 删除 .droid/obj 并清理 + 重建解决方案后 Resource.Designer.cs 文件中没有条目。

旧: 我已将样式添加到我的 Resource.Designer.cs 文件但没有成功。

// aapt resource value: 0x7f0a0174
public const int spinner_style = 2131362164;

它说它是自动生成的,但我似乎不能让它重新生成文件。如果我删除依赖于该文件的其他 类 内容,我将无法再次构建解决方案。

非常感谢任何帮助!

您可以在此处的示例中找到所需的样式:https://github.com/amccorma/xamarin-amccorma/blob/master/Forms.DropDown/DropDown.Droid/Resources/values/styles.xml

<style name="spinner_style">
  <item name="android:layout_margin">1dp</item>
  <item name="android:paddingLeft">1dp</item>
  <item name="android:paddingRight">1dp</item>
  <item name="android:paddingTop">1dp</item>
  <item name="android:paddingBottom">1dp</item>
  <item name="android:popupBackground">#FFFFFF</item>
</style>

要使用样式,您应该将其添加到样式文件中, 在 android 项目中 /Resources/values/styles.xml 文件