使用attr的android风格继承在棒棒糖前不起作用

使用attr的android风格继承在棒棒糖前不起作用,android,android-drawable,android-styles,Android,Android Drawable,Android Styles,我得到以下堆栈跟踪只有在前棒棒糖设备。只有在可绘制xml中使用?attr/border_color这种语法时,才会发生这种情况。如果我硬编码一种颜色,它就会工作 Caused by: android.content.res.Resources$NotFoundException: File res/drawable/border_not_left.xml from drawable resource ID #0x7f020042 at android.content.res.R

我得到以下堆栈跟踪只有在前棒棒糖设备。只有在可绘制xml中使用?attr/border_color这种语法时,才会发生这种情况。如果我硬编码一种颜色,它就会工作

 Caused by: android.content.res.Resources$NotFoundException: File res/drawable/border_not_left.xml from drawable resource ID #0x7f020042
        at android.content.res.Resources.loadDrawable(Resources.java:2235)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
        at android.view.View.<init>(View.java:3561)
        at android.widget.TextView.<init>(TextView.java:623)
        at android.widget.TextView.<init>(TextView.java:618)
border_not_left.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="?attr/border_color" />
        </shape>
    </item>
    <item android:bottom="1dp" android:right="1dp"  android:top="1dp" >
        <shape android:shape="rectangle">
            <solid android:color="?attr/border_inside_color" />
        </shape>
    </item>
</layer-list>
styles.xml

  <style name="MaterialAppTheme" parent="MaterialAppTheme.Base">

    </style>

    <style name="MaterialAppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="border_color">@color/black</item>
        <item name="border_inside_color">@color/border_background_light</item>
        <!--<item name="textColorPrimary">@color/textColorPrimary</item>-->
        <!--<item name="windowBackground">@color/windowBackground</item>-->
        <!--<item name="navigationBarColor">@color/navigationBarColor</item>-->
    </style>

    <style name="DarkBgLightBorderTheme" parent="MaterialAppTheme.Base">
        <item name="border_inside_color">@color/background_dark</item>
        <item name="border_color">@color/LightGrey</item>
    </style>

API 21中增加了对drawables中主题属性的支持。在早期平台上,不能在drawables中使用主题属性。