2017-07-03 50 views
0

此错误时Android Studio中找不到后台XML资源中可绘制文件夹

Error:(17, 29) No resource found that matches the given name (at 'background' with value '@drawable/shape_empty_big'

这里我的XML型文件

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" > 
<stroke android:width="1dp" 
    android:color="#FFFFFF"/> 
<corners 
    android:bottomLeftRadius="12dp" 
    android:bottomRightRadius="12dp" 
    android:topLeftRadius="12dp" 
    android:topRightRadius="12dp" /> 
</shape> 

这是我如何使用背景我button

android:background="@drawable/shape_empty_big" 

这里是我的绘图目录图片

drawable

THX的帮助,我很欣赏

+0

尝试清洗和重建项目.. –

+0

使名为shape_empty_big –

+0

确保你的XML谢谢你这么多古鲁普拉萨德。清洁和重建解决了我的问题。祝Guruprasad和Joe愉快 –

回答

0

我觉得你的代码是好的,你可以尝试清洗和重建项目。

下面,我用它来获得一个圆形按钮的代码:

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:state_pressed="false"> 
    <shape android:shape="oval"> 
     <solid android:color="@color/white" /> 

     <corners 
      android:bottomRightRadius="10dp" 
      android:bottomLeftRadius="10dp" 
      android:topLeftRadius="10dp" 
      android:topRightRadius="10dp"/> 

    </shape> 
</item> 
<item android:state_pressed="true"> 
    <shape android:shape="oval"> 
     <solid android:color="@color/gray"/> 
     <corners 
      android:bottomRightRadius="10dp" 
      android:bottomLeftRadius="10dp" 
      android:topLeftRadius="10dp" 
      android:topRightRadius="10dp"/> 
    </shape> 
</item> 
</selector> 
相关问题