I was designing an interface, and I was running into the following problem:
I'm integrating the component ratingBar
to one of my activities, and when I tried to set the number of maximum stars to 5 with the property numStars
, the application puts the number of stars it wants, ignoring the number I indicated.
How can I make my ratingBar
respect the number of stars that I am indicating?
In the documentation it says to use as width
wrap_content
,but you can use a larger customizable width to display all the stars.
The android:numStars property indicates how many stars appear:
The android:rating property indicates how the stars will be filled in by default:
The android:stepSize property indicates the size of the step.
Example:
First of all, the documentation says the following about the
numStars
propertyratingbar
:So, taking this into account, my XML
ratingBar
looked like this:in which, the property
numStars
indicates that only 5 stars will be put,stepSize
indicates as soon as the star is "parted", placing it in.5
, you can only select half a star, or the full star.