D
D
dimasik1002002018-02-06 22:17:14
Java
dimasik100200, 2018-02-06 22:17:14

How to set a reference to the @color/color*** resource in the icon drawable file in android:fillColor?

There is a problem. I created an icon using Vector Asset and would like to change its color, but when using this method android:fillColor="@color/color***" errors start to fly out. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Varakosov, 2018-02-07
@thelongrunsmoke

Vector icons are rasterized at build time for compatibility purposes, so you won't be able to use resources.
If you need a permanent color, then you have to hardcode it. If you need to change the color of the icon, then you need to use it android:tintin the markup where the icon is used, or programmatically using setTint ().

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question