Hi I am facing a problem I 开发者_Python百科want my application to pick up resources from the framework. Here is my code snippet of an xml.
For this to be achieved following changes were made in attrs.xml
and themes.xml at the framework level
@android:drawable/btn_minus_ss
The drawable btn_minus_ss.png is added to drawable-hdpi folder at the location framework/base/core/res/res/drawable-hdpi Whenever I open the application, it crashes. I get the following error in logs
ERROR/AndroidRuntime(3701): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: tag requires a 'drawable' attribute or child tag defining a drawable
However, when I use this android:background="?android:attr/theme_btn_minus_ss" I don't get any error. I want to use android:drawable What is the cause and how can this problem be solved.
Thanks & Regards Aviral
The error
ERROR/AndroidRuntime(3701): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: tag requires a 'drawable' attribute or child tag defining a drawable
has to do with the format of your xml, you are setting something like
<item android:background="@foo-value-here" />
What the error is telling you is that it should be like this
<item android:drawable="@foo-value-here" />
i think i had the same problem, it seems to be a bug in the android eclipse-plugin. the solution is the same as for this question (close eclipse and restart it): android include tag - invalid layout reference
Also make android:drawable the first attribute of item tag - it worked for me.
精彩评论