Android 自定义分级栏?
我有一个布局。我在其中嵌入了一个自定义评级栏:Android 自定义分级栏?,android,android-theme,ratingbar,Android,Android Theme,Ratingbar,我有一个布局。我在其中嵌入了一个自定义评级栏: <RatingBar android:id="@id/rate" style="?android:attr/ratingBarStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_
<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" />
star\u empty\u show
和star\u filled\u show
都是.png
文件,位于项目的drawable
文件夹中。上述两个代码都没有错误,但在图形布局
选项卡中我看到:
Failed to parse file E:\...\res\drawable\ratebar_theme.xml
org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
在错误日志中
我看到:
Failed to parse file E:\...\res\drawable\ratebar_theme.xml
org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
org.xmlpull.v1.XmlPullParserException:二进制XML文件行#6:tag需要一个“drawable”属性或定义drawable的子标记
但是我为每个项目添加了
drawable
属性。ypu知道为什么会发生此错误吗?简单地清理您的项目并重新启动eclipse,希望它能工作。试试这个
<?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>
我不明白您遇到了什么错误尝试清理项目,然后重新启动eclipse@Janmejoy此错误发生在运行应用程序之前。是否清理并运行应用程序project@StudentStudent这很酷,我想在清理和构建之后,你也没有得到,这就是为什么我发布这篇文章…你必须在每个项目中从@+android:id
中删除“+”。