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> </style>
However instead of scaled stars I'm receiving cropped stars:
Is there a way to change the size of the stars?
Custom Rating Bar in AndroidCopy your images in the drawable folder and remember image size should be according to the size you want. Step 2. Make XML for the rating bar selector in the drawable folder like below. We made two files, one for the fill or highlighted part and one for the empty or un-highlighted part.
You can set it in the XML code for the RatingBar, use scaleX and scaleY to adjust accordingly. "1.0" would be the normal size, and anything in the ". 0" will reduce it, also anything greater than "1.0" will increase it.
A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars. The user can touch/drag or use arrow keys to set the rating when using the default size RatingBar. The smaller RatingBar style ( R.
Another approach would be scaling the widget:
android:scaleX="0.5" android:scaleY="0.5"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With