当我尝试在 Lollipop 上使用渐变时,它不起作用。 虽然它适用于所有以前的版本。
这是我的例子:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:type="radial" android:gradientRadius="500"
android:startColor="#00417e" android:endColor="#001b34" />
最佳答案
我遇到了同样的问题并创建了 2 个不同的文件:
在绘图中
android:gradientRadius="270"
在 drawables-v21 中
android:gradientRadius="270dp"
现在它工作正常。
关于Lollipop 上的 Android 渐变无法正常工作。 - API 21,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27384655/