Marcin S. Marcin S. - 1 year ago 323
Android Question

How to set the custom size of the stars in RatingBar

I have already added a style

<style name="myRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:minHeight">32dp</item>
<item name="android:maxHeight">32dp</item>

However instead of scaled stars I'm receiving cropped stars:

enter image description here

Is there a way to change the size of the stars?

Answer Source

Android won't scale a rating bar icons. When you decrease the minHeight and maxHeight android will always crop the icons as shown on the picture. The workaround for it and seems to be the only one solution is to provide your own icons for stars with the desired dimensions and set the minHeight and maxHeight to the size of the icons.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download