问题描述
- 在layout建立一个attrs.xml文件,在布局testinfo.xml 会报错
-
error: Error: No resource found that matches the given name (at 'background' with value '@drawable/ok'). [2015-05-13 06:41:13 - example] [2015-05-13 06:41:13 - example] : error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cancle').
attrs.xml<!-- Declare custom theme attributes that allow changing which styles are used for button bars depending on the API level. ?android:attr/buttonBarStyle is new as of API 11 so this is necessary to support previous API levels. --> <declare-styleable name="ButtonBarContainerTheme"> <attr name="buttonBarStyle" format="reference" /> <attr name="buttonBarButtonStyle" format="reference" /> </declare-styleable>
testinfo.xml
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/testlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="4"
>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/bg" ><LinearLayout android:id="@+id/testlinear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginTop="5dp" android:background="@drawable/bg" android:orientation="vertical" android:gravity="bottom"> </LinearLayout> </ScrollView>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_weight="1"
android:orientation="horizontal"
android:background="@drawable/share_bg_tab_normal"
>
android:id="@+id/ok"
android:layout_marginLeft="15dp"
android:layout_marginRight="30dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingBottom="6dp"
android:layout_weight="1"
android:paddingTop="6dp"
android:background="@drawable/ok"
/>
android:layout_marginLeft="30dp"
android:layout_marginRight="15dp"
android:id="@+id/cancle"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/cancle"
/>
解决方案
@drawable/ok
@drawable/cancle
检查一下这两个资源文件在对应的drawable目录下有没有
解决方案二:
cancle 拼写错了?去drawable下看下有这2张图么
在layout下不能建立一个attrs.xml文件 要键在values目录下
你的testinfo.xml 看起来不完整