Using Android RatingBar, I want the ratings stars to have the following colors (all stars the same color per rating):
- One star: red
- Two stars: yellow
- Three stars: blue
- Four stars: green
- Five stars: dark green
This is my code:
RatingBar rateDoctor;
rateDoctor = (RatingBar)findViewById(R.id.rateDoctor);
rateDoctor.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float v, boolean b) {
}
});
And my XML:
<RatingBar android:id="@+id/rateDoctor" android:layout_marginTop="15dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numStars="5" android:stepSize="1.0" />