Android 我得到“错误:链接文件资源失败”-为什么?

Android 我得到“错误:链接文件资源失败”-为什么?,android,android-studio,Android,Android Studio,我是android开发的绝对初学者。我正在尝试建立一个搜索框。所以我在我的活动中放了一个searchview小部件。当我运行应用程序时,它会给我这个错误 error: 'searchBoxColor' is incompatible with attribute background (attr) reference|color. error: failed linking file resources. 我想不出错误在哪里。或者是否有其他文件需要添加到链接资源中 这是我的color.xml

我是android开发的绝对初学者。我正在尝试建立一个搜索框。所以我在我的活动中放了一个searchview小部件。当我运行应用程序时,它会给我这个错误

error: 'searchBoxColor' is incompatible with attribute background (attr) 
reference|color.
error: failed linking file resources.
我想不出错误在哪里。或者是否有其他文件需要添加到链接资源中

这是我的color.xml文件

<?xml version="1.0" encoding="utf-8"?>
<resources>
        <color name="colorPrimary">#3d664a</color>
        <color name="colorPrimaryDark">#00574B</color>
        <color name="colorAccent">#D81B60</color>
        <color name="backgroundColor">#e1e6e6</color>
        <color name="searchBoxColor">#d6d2d6</color>
</resources>
这是我的布局xml文件

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:fillViewport="true"
     android:overScrollMode="never"
     android:scrollbars="none">

    <RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@color/backgroundColor" >

         <SearchView
              android:id="@+id/search"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:iconifiedByDefault="false"
              android:queryHint="Search Here"
              android:background="searchBoxColor"
              android:padding="6dp" >

              <requestFocus />
          </SearchView>

    </RelativeLayout>

 </ScrollView>

在背景属性中添加颜色路径

android:background="@color/searchBoxColor"
应该是

 <SearchView
          android:id="@+id/search"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:iconifiedByDefault="false"
          android:queryHint="Search Here"
          android:background="@color/searchBoxColor"
          android:padding="6dp" >