FlyingPumba / SimpleRatingBar

Open source project which features a simple yet powerful RatingBar alternative to Android's default
Apache License 2.0
1.03k stars 142 forks source link

Rating not accurate #18

Closed ericntd closed 7 years ago

ericntd commented 7 years ago

First of all, your library is the best out there, it really stands out from the competition!

I'm sure I'm missing something very obvious here :) I'm referring to your demo app.

I have the following in fragment_size_of_stars.xml:

<com.iarcuschin.simpleratingbar.SimpleRatingBar
            android:id="@+id/ratingBar2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            app:srb_drawBorderEnabled="true"
            app:srb_borderColor="@color/material_blue500"
            app:srb_fillColor="@color/material_blue300"
            app:srb_pressedBorderColor="@color/material_blueA400"
            app:srb_pressedFillColor="@color/material_blueA200"
            app:srb_starSize="20dp"
            app:srb_rating="4"
            app:srb_stepSize="0.1"
            app:srb_numberOfStars="5"
            app:srb_isIndicator="true"
            />

However the result is not 3.3 at all (blue stars; the second rating bar): device-2016-11-29-002349

FlyingPumba commented 7 years ago

Thanks for the bug report ! I'll look into it.

FlyingPumba commented 7 years ago

@ericn37 sorry for the delay. I think the problem comes from the fact that the rating is calculated without subtracting the separation between stars.. It seems to work just fine for larger stars:

photo_2016-12-21_18-46-00

FlyingPumba commented 7 years ago

@ericn37 hopefully solved. There was a bug in the drawing method which could have caused wrong display of rating due to a wrong float math. Check it out in next version (0.14) and let me know if you find anything suspicious :)

mob-rockstar commented 5 years ago

How can I set a float rating like 3.5, 2.3, 4.7?