“解析XML时出错:文档元素后出现垃圾”
问题描述:
我在尝试创建自定义按钮时收到此错误消息,我已经尝试了大多数类似于我的问题的答案,但无法使其工作。任何帮助非常感谢。另外,因为这是我第一次在这里发表,请原谅我,如果规则有任何问题。“解析XML时出错:文档元素后出现垃圾”
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
<Selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/touchlighter" android:state_pressed="true"/>
<item android:drawable="@drawable/touch"/>
</Selector>
</RelativeLayout>
答
你键入<Selector ...
其中<RelativeLayout>
的属性应该去。
我认为正确的XML应该是:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Selector>
<item android:drawable="@drawable/touchlighter" android:state_pressed="true"/>
<item android:drawable="@drawable/touch"/>
</Selector>
</RelativeLayout>