ratingbar - Android using setNumStars to change stars during execution make the ratings act strange -


i'm using rb.setnumstars(int) change stars form given default value (say 5) new 1 app preferences (say 4). code performs ok , after refresh fragment, can see change in stars number integer set (the bar has stepsize of 1).

the problem when try set rating on bar, filled stars not coincide rating value, , have touch in strange places come values, i.e. if touch fist star, rating = 1, if touch second, still have rating = 1 , filled stars 1 , fragment of second. if touch between second , third star, rating = 2 , 2 , fragment filled stars.

imagine this: if f full star, p partial (but not in half star) , e empty star, if touch second star, , between 2nd , 3rd get:

f p e e rating = 1 f f p e rating = 2

edit: images can found here: http://1drv.ms/1pyq3gs

if return value 5, bar behaves expected, filled stars coinciding rating.

i can not insert images, explain behavior, hope it's clear enough.

does knows why happening , how correct it?

it seems able answer own question.

as extension of progress bar, i´m guessing when change number of stars, progress bar stretching new width, keeping it's original values, not reflecting portion must fill. using setmax rating bar, think i´m setting new limits bar, so, changed number of stars , set max value number, this:

ratingbar rb = (ratingbar) view.findviewbyid(rbars[r]); rb.setnumstars(integer.valueof(sp.getstring(rchars[r], "3"))); rb.setmax(integer.valueof(sp.getstring(rchars[r],"3"))); rb.setrating(2); 

in way rating coincide filled stars.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -