Change fillColor of a vector in android programmatically

后端 未结 5 2280
情书的邮戳
情书的邮戳 2020-12-15 03:13

I want to edit the fill Color of a vector-file in Android programmatically.

In the xml-file I can set my color with the attribute android:fillColor

5条回答
  •  北海茫月
    2020-12-15 03:33

    button.setColorFilter(getResources().getColor(R.color.YOUR_COLOR));

    example:

    dislikeBtn.setColorFilter(getResources().getColor(R.color.grey));

提交回复
热议问题