我的xml文件如下。 ADT问我这个问题 “无法解析文件E:\ Applications \ Vishal \ Workspace \ MyApp \ res \ drawable \ day.xml”
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:state_focused="false"
android:background="@android:color/transparent"
android:drawable="@drawable/dayoff"/>
<item
android:state_pressed="false"
android:state_focused="true"
android:background="@android:color/transparent"
android:drawable="@drawable/dayon"/>
<item
android:state_pressed="false"
android:state_focused="true"
android:background="@android:color/transparent"
android:drawable="@drawable/dayon"/>
<item
android:drawable="@drawable/dayon"/>
</selector>
这里dayoff和dayon是drawable文件夹下的两个png图像..
哪里错了?建议PLZ。
答案 0 :(得分:0)
<item
android:state_pressed="true"
android:drawable="@drawable/dayon"/>
<item
android:state_focused="true"
android:drawable="@drawable/dayon"/>
<item
android:drawable="@drawable/dayoff"/>
</selector>
答案 1 :(得分:0)
您的代码100%正确..我认为您正在使用的PNG可能已损坏......
OR
在启动day.xml文件之前检查是否有空格.....