Reputation: 485
Can anyone tell me how to change stars colour.I have tried backtracing in styles but couldn't find the color tag which it was using instead it uses drwables for that.
<me.zhanghai.android.materialratingbar.MaterialRatingBar
android:id="@+id/avgRatingBar"
style="@style/Widget.AppCompat.RatingBar.Indicator"
android:layout_width="193dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/insideLocationMainImage"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="189dp"
android:layout_marginBottom="-5dp"
android:isIndicator="true"
android:numStars="5"
android:rating="1"
android:outlineAmbientShadowColor="@color/yellow"
android:outlineSpotShadowColor="@color/yellow"
android:stepSize="1"
app:mrb_fillBackgroundStars="true" />
Thanks in advance
Upvotes: 3
Views: 933
Reputation: 5636
You can use a style similar to this
<style name="RatingBar" parent="Theme.AppCompat">
<item name="mrb_progressTint">@color/Goldenrod</item>
<item name="mrb_secondaryProgressTint">@color/Black</item>
<item name="mrb_progressBackgroundTint">@color/Blue</item>
<item name="mrb_fillBackgroundStars">false</item>
</style>
to change the colors of the Material Rating Bar.
In the above picture I've used three different parameters;
The first one has mrb_progressTint=@color/White
so that one can see that there is always a thin border.
The second one has changed mrb_fillBackgroundStars=true
that asks to fills the stars. Notice that the progress is always filled. Also, notice the half black star, too. So, the border color fills completely the star except the progressed ones. We can see this from the third picture that the golden still has a thin black border.
Upvotes: 3