我有一个布局。我在其中嵌入了一个自定义评分栏:
<RatingBar
android:id="@id/rate"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5.0dip"
android:isIndicator="true"
android:max="5"
android:numStars="5"
android:progressDrawable="@drawable/ratebar_theme"
android:stepSize="0.1" />
它是ratebar_theme
:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@android:id/background"
android:drawable="@drawable/star_empty_show"/>
<item
android:id="@android:id/secondaryProgress"
android:drawable="@drawable/star_empty_show"/>
<item
android:id="@android:id/progress"
android:drawable="@drawable/star_filled_show"/>
</layer-list>
star_empty_show
和都是项目文件夹star_filled_show
中的文件。以上代码都没有错误,但在选项卡中我看到了这个:.png
drawable
Graphical layout
Failed to parse file E:\...\res\drawable\ratebar_theme.xml
在Error Log
我看到这个:
org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
但是我已经drawable
为每个项目添加了属性。你知道为什么会发生这个错误吗?