Search code examples
androidfocusratingbar

Change or remove RatingBar focus color


I have RatingBar and style. I want to remove focusing color at the RatingBar.

My empty RatingBar's colors: enter image description here My RatingBar's focusing color: enter image description here I want to remove focusing color: enter image description here

theme:

 <style name="CustomRatingBar" parent="Theme.AppCompat">
    <item name="colorControlNormal">@color/lightTransparentBlack</item>
    <item name="colorControlActivated">@color/yellow</item>
</style>

layout:

<RatingBar
  android:id="@+id/ratingBar"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  android:theme="@style/CustomRatingBar"
  android:layout_marginTop="20dp"
  android:numStars="5"
  android:stepSize="1" />

Solution

  • 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"