所以我有一个XML类来提供圆角按钮:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="225"
android:startColor="#A5C938"
android:endColor="#A5C938"/>
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
在较旧的设备上,当我通过:android:background=“@drawable/rounded”按钮引用此文件时,会出现一个崩溃,说明它不是一个drawable
Caused by: android.content.res.Resources$NotFoundException: Resource "com.chimesoftware.chime.chimetimemanager:drawable/rounded_button" (7f0700ae) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0700ae a=-1 r=0x7f0700ae}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:4017)
at android.content.res.Resources.loadDrawable(Resources.java:3929)
at android.content.res.Resources.loadDrawable(Resources.java:3779)
at android.content.res.TypedArray.getDrawable(TypedArray.java:776)