2

I'am working on small sized golden yellow color ratingbar,which is to show some rating in float numbers like 4.2,3.75 etc.I have implemented the rating bar as below:-

                    <RatingBar
                        android:id="@+id/ratingBar1"
                        style="?android:attr/ratingBarStyle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:isIndicator="true"
                        android:numStars="5"
                        android:theme="@style/RatingBar"
                        android:progressTint="@color/golden_yellow"
                        android:secondaryProgressTint="@color/golden_yellow"
                     />

@style/RatingBar:-

     <style name="RatingBar" parent="Theme.AppCompat">
    <item name="colorControlNormal">@color/golden_yellow</item>
    <item name="colorControlActivated">@color/golden_yellow</item>
    <item name="ratingBarStyle">@style/Base.Widget.AppCompat.RatingBar.Small</item>
</style>

Now the problem is ,stars of rating bar is fully or half filled when giving the rating value as like 4.2 or 4.7 etc.I have given the stepsize as 0.1

    ratingBar1.setStepSize((float) 0.1);

    ratingBar1.setRating((float) 4);

I have given rating value as 4.2 but getting the output like this:

enter image description here

can someone help me to find the answer????

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Rib
  • 29
  • 4
  • It would be useful if if you post the screenshots. – Shashanth Oct 12 '17 at 11:58
  • 1
    I have posted the screenshot.please check the question – Rib Oct 12 '17 at 12:06
  • Check this and you have create custom rating bar. [Custom rating bar](https://stackoverflow.com/questions/21113807/when-i-use-custom-stars-for-android-ratingbar-always-show-half-star-for-decimal) – Omar Hayat Oct 12 '17 at 12:53
  • Sorry it does'nt worked for me.atlast i have used a library https://github.com/FlyingPumba/SimpleRatingBar – Rib Oct 20 '17 at 11:18

0 Answers0