Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow full values (integers) only in ratingbars?

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.

like image 951
Frank Avatar asked Jan 08 '13 15:01

Frank


People also ask

What is step size in rating bar?

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.

How to get RatingBar value in android?

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();

How to store rating value in database in android?

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; ............. .......................


1 Answers

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.

like image 59
codeMagic Avatar answered Sep 24 '22 10:09

codeMagic