I'm facing a small problem with the LinearGradient definition in XML. What I want is to use the constructor that accepts the array of colors and the array of positions.

This one:

    LinearGradient(float x0, float y0, float x1, float y1, 
int[] colors, float[] positions, Shader.TileMode tile)

How do I pass the array in the XML? Here's the example of XML with gradient definition, but the simple one.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:startColor="#474946"
        android:endColor="#181818"
        android:angle="270"/>
    <corners android:radius="5dp" />
</shape>
Edit
Report