In my activity I have some Rating bars. But the size of this bar is so big! How can I make it smaller?
Edit
Thanks to Gabriel Negut, I did it with the following style:
<RatingBar
style = "?android:attr/ratingBarStyleSmall"
android:numStars = "5"
android:rating = "4" />
Now, the size is reduced but number of stars and rating do not take effect!!! Why? I have 7 stars that 6 of them is selected.
The below snippet worked for me to resize the ratingBar
If you are using Rating bar in Linearlayout with weightSum. Please make sure that you should not assign the layout_weight for rating bar. Instead, that place rating bar inside relative layout and give weight to the relative layout. Make rating bar width wrap content.
For those who created rating bar programmatically and want set small rating bar instead of default big rating bar
The original link I posted is now broken (there's a good reason why posting links only is not the best way to go). You have to style the
RatingBar
with eitherratingBarStyleSmall
or a custom style inheriting fromWidget.Material.RatingBar.Small
(assuming you're using Material Design in your app).Option 1:
Option 2:
In
RatingBar
give attribute:You can set it in the XML code for the
RatingBar
, usescaleX
andscaleY
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.