LayerList错误API 19:标记需要一个' drawable'定义drawable的属性或子标记

时间:2016-08-11 13:43:56

标签: android xml-drawable

这是我的图层列表drawable,我用它作为按钮的背景。它适用于android 6(API 23)但在Android 4.4(API 19)上崩溃。如何修复我的drawable,使其适用于从API 15开始的所有API?

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <color android:color="@android:color/white" />
    </item>
    <item android:drawable="?android:attr/selectableItemBackground"></item>
</layer-list>


Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
    at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:164)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:990)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:930)

0 个答案:

没有答案