The size of the step bar does not work in candy. But it works in marshmallows

I made a ratingBar, but when setting the rating to 2.5, the Bar rating in the lollipop shows 3 stars, but 2 full stars and half a star are shown in marshmallows. I want to get 2 and a half stars on all devices.

The type of rating that I use

<style name="smallRatingBar" parent="@android:style/Widget.Material.RatingBar.Small"> <item name="android:progressTint">@color/custom_red</item> <item name="android:progressBackgroundTint">@android:color/darker_gray</item> <item name="android:secondaryProgressTint">@color/custom_red</item> <item name="android:numStars">5</item> <item name="android:stepSize">0.5</item> </style> 

And used rating score

 <RatingBar android:id="@+id/comment_rating" android:layout_width="wrap_content" android:layout_height="wrap_content" android:isIndicator="true" android:layout_gravity="center_vertical" style="@style/smallRatingBar" android:stepSize="0.5" android:rating="2.5"></RatingBar> 

And here are the screenshots (the first image from the candy and the second from the marshmallow)

Rating shown on candy devices Rating shown in marshmallow devices

I want the candy to have half the stars. Please, help.

[EDIT 1] Java Code:

 RatingBar ratingBar = (RatingBar) view.findViewById(R.id.comment_rating); ratingBar.setRating(item.getRating()); //getRating returns float value 

This happens inside the listview adapter

+5
source share

All Articles