4

I am trying to set a custom color for the small progressbar with this code:

<style name="RatingBar" parent="Theme.AppCompat">
        <item name="colorControlNormal">@color/gold_yellow</item>
        <item name="colorControlActivated">@color/light_grey</item>
    </style>




<RatingBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:isIndicator="true"
        android:rating="3.3"
        android:theme="@style/RatingBar"
        android:id="@+id/go_rating"
        style="@android:style/Widget.Holo.Light.RatingBar.Small"/>

The problem with this is this: the stars are small quite alright but they are blue. But If I remove style="@android:style/Widget.Holo.Light.RatingBar.Small then the color becomes golden yellow but it becomes big.

Please how do I set custom colors for the stars and at the same time make it small?

X09
  • 3,827
  • 10
  • 47
  • 92

1 Answers1

16

Use style="?attr/ratingBarStyleSmall" style:

<RatingBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:isIndicator="true"
    android:rating="3.3"
    android:theme="@style/RatingBar"
    android:id="@+id/go_rating"
    style="?attr/ratingBarStyleSmall"/>

see also: https://stackoverflow.com/a/3173594/5183999

Community
  • 1
  • 1
nshmura
  • 5,940
  • 3
  • 27
  • 46
  • Thanks! You did it! And I've been struggling for more 3 hours just because of this. Thanks! – X09 Aug 21 '16 at 13:00