Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fill a vector xml path with radial color shade

I want to know if there is a chance to fill a path with a radial color shade in an XML-drawable.

My XML:

<?xml version="1.0" encoding="utf-8"?>
vector android:height="64.0dip" android:width="64.0dip" android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">

path android:fillColor="#ff2196f3" android:pathData="M 64.07531,31.855837 A 32.037655,32.037655 0 0 1 32.037655,63.893492 32.037655,32.037655 0 0 1 0,31.855837 32.037655,32.037655 0 0 1 32.037655,-0.18181801 32.037655,32.037655 0 0 1 64.07531,31.855837 Z" android:strokeWidth="1.0"

  group android:translateX="9.0" android:translateY="6.0"

   path android:fillColor="#ffffffff" android:pathData="M20.4,18.0"

   path android:fillColor="#ffffffff" android:pathData="M42.0,32.0l0.0,-4.0L26.0,18.0L26.0,7.0c0.0,-1.7 -1.3,-3.0 -3.0,-3.0c-1.7,0.0 -3.0,1.3 -3.0,3.0l0.0,11.0L4.0,28.0l0.0,4.0l16.0,-5.0l0.0,11.0l-4.0,3.0l0.0,3.0l7.0,-2.0l7.0,2.0l0.0,-3.0l-4.0,-3.0L26.0,27.0L42.0,32.0z"

  /group

/vector>

The first path is the background circle that I want to fill with a radial color shade, I can fill it with a solid color only until now..I haven't found anything on the web...Can you help me please?

ANSWER: I found the answer here

VectorDrawable does not support gradients below api 24

like image 272
ami87 Avatar asked Nov 10 '22 13:11

ami87


1 Answers

from the SDK Documentation: VectorDrawable

android:fillColor Specifies the color used to fill the path. May be a color or, for SDK 24+, a color state list or a gradient color (See GradientColor and GradientColorItem). If this property is animated, any value set by the animation will override the original value. No path fill is drawn if this property is not specified.

android:strokeColor Specifies the color used to draw the path outline. May be a color or, for SDK 24+, a color state list or a gradient color (See GradientColor and GradientColorItem). If this property is animated, any value set by the animation will override the original value. No path outline is drawn if this property is not specified.

VectorDrawable

like image 117
SjoerdvGestel Avatar answered Nov 22 '22 08:11

SjoerdvGestel