Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom rating bar?

I have a layout.I have embedded a custom rating bar in it:

<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" />

It is 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>

Both star_empty_show and star_filled_show are .png files in drawable folder of project.Both above codes have no error,but in Graphical layout tab I see this:

Failed to parse file E:\...\res\drawable\ratebar_theme.xml

And in Error Log I see this:

  org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable

But I have add drawable attribute to each item.Do ypu know why this error occures?

like image 691
Student Student Avatar asked Dec 15 '25 19:12

Student Student


1 Answers

Simple Clean your project and restart your eclipse, hopefully it works.

like image 170
RobinHood Avatar answered Dec 17 '25 14:12

RobinHood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!