我在此XML中有一个可绘制对象:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="@color/transparent"
android:gradientRadius="200dp"
android:startColor="?attr/primaryDarkTransparent"
android:type="radial" />
</shape>
[startColor
使用?attr/primaryDarkTransparent
时XML导致崩溃:
Caused by: java.lang.RuntimeException: org.xmlpull.v1.XmlPullParserException: <internal><gradient> tag requires 'gradientRadius' attribute with radial type
Caused by: org.xmlpull.v1.XmlPullParserException: <internal><gradient> tag requires 'gradientRadius' attribute with radial type
[戏剧性的故事是,当我在attr
和solid
中使用stroke
时,效果很好,但我不知道gradient
中到底发生了什么。
任何建议将不胜感激。
shape
中有两个问题。