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.
Its nothing but a factor by which you increase ratings on RatingBar. If you want ratings to be displayed like 3.5 or 4.5, you can use stepSize as 0.5. Incase, you want ratings like 3.1 or 4.3, you can have stepSize like 0.1.
In android, by using RatingBar methods (getNumStars(), getRating()) we can get the number of stars and the rating value which was selected. Following is the code snippet to get the rating details from RatingBar in android applications. int noofstars = rBar. getNumStars();
You should add 10 RatingBar and 10 TextView in your layout XML . Use different id for RatingBar (rb1, rb2, rb3.....) and TextView (tv1, tv2, tv3.....) . Get rating values from database : Float rating1 = 1.0; Float rating2 = 1.0; Float rating3 = 3.0; ............. .......................
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.
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