Why is my layer-list gradient drawing differently on Android 10?

  android

My gradient is drawing as a nice downwards glow on Android 9 and below, but shows up as a horrible solid chunk on Android 10.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:angle="360"
                android:startColor="#f0ad4e"
                android:centerColor="#d9534f"
                android:endColor="#e77e99"
                android:type="linear"/>

        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:angle="45"
                android:endColor="@android:color/transparent"
                android:startColor="#eee"
                android:type="linear"/>
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:angle="-45"
                android:startColor="@android:color/transparent"
                android:endColor="#eee"
                android:type="linear"/>
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:startColor="@android:color/transparent"
                android:endColor="#eee"
                android:type="linear" />
        </shape>
    </item>
</layer-list>

Result on Android 9 and below:
Android 9

Result on Android 10:
enter image description here

Source: Android Questions

LEAVE A COMMENT