본문 바로가기

안드로이드 노트

[안드로이드][프로젝트2] ratingBar 별 색깔 바꾸기

1. res/values/style.xml에서 다음과 같이 코드를 쓴다.

 

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

colorControlNormal에선 안 채워졌을 때의 색을,

colorControlActivated에선 채워졌을 때의 색을 넣으면 된다.

 

2. layout RatingBar에 다음과 같이 theme을 적용해준다.

 android:theme="@style/RatingBar"

 

완성!

 

참고:

https://stackoverflow.com/questions/39913495/ratingbar-color-difference-on-different-devices

 

RatingBar color difference on different devices

I have a RatingBar <android.support.v7.widget.AppCompatRatingBar android:id="@+id/rating" android:layout_width="wrap_content" android:layout_height="

stackoverflow.com