How to change starts image of rating bar in android

Yoav picture Yoav · Sep 16, 2011 · Viewed 7.1k times · Source

How can I change the starts image in the android rating bar?

I need it to show it to the user.

Or if not possible - how can show X images of start in a specific possition in the layout?

Yoav

Answer

Peter Knego picture Peter Knego · Sep 16, 2011

I hope I understod your question - you want to use RatingBar and set custom images?

Android's RatingBar already displays stars, but if you want custom image then Define a custom style

<style name="customRatingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/custom_image</item>
    <item name="android:indeterminateDrawable">@drawable/custom_image</item>
</style>

And then use it

<RatingBar style="@style/customRatingBar" ... />