How can I set the color of android rating bar's stroke? (Not the color of the stars but the BORDER)

后端 未结 5 1159
遥遥无期
遥遥无期 2020-12-14 16:24

I am an android beginner and I want to make my custom ratingBar.

Disclaimer: it\'s not a duplicate. because all the posts I have read asks about how to change colors

5条回答
  •  臣服心动
    2020-12-14 16:58

    I think I actually found what you need. You will have to create a custom RatingBaras explained in this answer BUT you will have to use vector drawables and not standard ones.

    You can download the 3 drawables (full, half and empty) on this website:

    https://materialdesignicons.com/

    Or by doing a right click on your res folder: --> New --> Vector asset on Android Studio.

    Here are the 3 drawables XML in case you don't find them:

    Full star:

    
    
    

    Half star:

    
    
    

    Empty star:

    
    
    

    To change their size, just update the attributes height and width.

    To change their color, just update the attribute fillColor and set your yellow color.

提交回复
热议问题