Android: Change color of ratingbar to golden [duplicate]
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/lightGrey</item>
<item name="colorControlActivated">@color/duskYellow</item>
</style>
On API 21 and higher, you can change the color of the filled stars with
android:progressTint="@color/color"
and the color of the stroke with
android:progressBackgroundTint="@color/color"
As you mentioned that you want to change the star color without using the drawable. You can do it by few lines of code as below.
RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingBar);
Drawable drawable = ratingBar.getProgressDrawable();
drawable.setColorFilter(Color.parseColor("#0064A8"),PorterDuff.Mode.SRC_ATOP);