错误解析XML为Android:绘制 [英] Error Parsing XML for android:drawable
问题描述
喜 我面临的一个问题 我想我的应用程序拿起资源的框架。这是我的code的XML的代码段。
Hi I am facing a problem I want my application to pick up resources from the framework. Here is my code snippet of an xml.
有关这是继在attrs.xml作了修改实现
For this to be achieved following changes were made in attrs.xml
和的themes.xml在框架级别
and themes.xml at the framework level
@android:绘制/ btn_minus_ss
@android:drawable/btn_minus_ss
提拉btn_minus_ss.png被添加到绘制,华电国际文件夹的位置框架/基/核心/ RES / RES /绘制,华电国际 每当我打开应用程序,它崩溃。 我得到在日志中出现以下错误
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):org.xmlpull.v1.XmlPullParserException:二进制XML文件中的行#5:造成标签需要一个'绘制'属性或子标签定义绘制
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
然而,当我用这个 机器人:背景=机器人:ATTR / theme_btn_minus_ss 我没有得到任何错误。我想用 机器人:可绘制 原因是什么,以及如何可以在此问题得到解决。
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.
感谢和放大器;此致 Aviral
Thanks & Regards Aviral
推荐答案
错误
ERROR / AndroidRuntime(3701):org.xmlpull.v1.XmlPullParserException:二进制XML文件中的行#5:造成标签需要一个'绘制'属性或子标签定义绘制
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
,是因为有你的XML格式,要设置类似
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" />
这篇关于错误解析XML为Android:绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!