问题
My client wants a ratingbar in one of the activities, but he doesn't want it to allow half-stars (aka float) values. I've been google-ing around but found nothing about it. Does anybody know if it is possible to force the ratingbar to not allow half-stars?
Thanks in advance.
回答1:
Should be able to use setStepSize()
and use a 1.0
to allow increments of 1 star instead of 0.5
for half stars
Here is the docs on it.
回答2:
It can be set in the xml too, with
android:stepSize="1"
回答3:
Try to set the Step size like this
ratingBar.setStepSize(1.0);
来源:https://stackoverflow.com/questions/14218029/how-to-allow-full-values-integers-only-in-ratingbars