为什么我的图层列表渐变在Android 10上的绘制方式不同?
我的渐变在Android 9和更低版本上绘制为一个漂亮的向下发光,但在Android 10上显示为一个可怕的实心块为什么我的图层列表渐变在Android 10上的绘制方式不同?,android,Android,我的渐变在Android 9和更低版本上绘制为一个漂亮的向下发光,但在Android 10上显示为一个可怕的实心块 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape andr
<?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>
Android 9及以下版本的结果:
Android 10上的结果:
在Android 10上,图层列表中渐变的默认角度似乎已更改为
0
。在最后一个
上设置angle=“270”
,修复此问题
注意:设置angle=“270”
后,导致Android 9上的渐变绘制错误。我还必须将angle=“-45”
更改为angle=“315”