I want to change color of rating bar to golden.
I dont want to customize the stars, i just want to change the color for API 16 or above
I have tried following solutions but none of them worked out for me
1.
RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingBar);
LayerDrawable stars = (LayerDrawable) ratingBar.getProgressDrawable();
stars.getDrawable(2).setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP);
2.
android:progressDrawable="@color/golden" in XML
This option is now included in the AppCompat library. The AppCompat version of the RatingBar is used automatically.
http://developer.android.com/reference/android/support/v7/widget/AppCompatRatingBar.html
Example (from my own app):
<RatingBar
android:id="@+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="1"
android:theme="@style/RatingBar"/>
With theme:
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">@color/duskYellow</item>
<item name="colorControlActivated">@color/lightGrey</item>
</style>