1

I have a vector drawable that I am using in an Android app. One of the path elements has a fillColor set to a gradient. This is defined in the XML and it works great when the target device is running API 24 or later. I can have it work for older versions by placing having two versions of the vector drawable. One using a solid color fpr fillColor in the res/drawable folder and the one with the gradient in a res/drawable-v24 folder. Is it possible to define the gradient in another file so that it could be referenced as a color in <24 and as a gradient in 24 (and later)? Something like

<path
    android:pathData="some random path inserted here"
    android:fillColor="@color/myGradient">

Is there a way to define a gradient so that it can be referenced in that way?

Chris Miller
  • 4,809
  • 4
  • 33
  • 50

0 Answers0