首先5.0以上不会有问题,4.*系统都会有问题
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@android:color/white" />
<corners android:radius="2dip" />
<stroke
android:width="0.7dp"
android:color="?colorAccent" />
</shape>
</item>
</layer-list>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
异常
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/edit_background_hover.xml from drawable resource ID #0x7f02005b
这种引用只支持api>=21的安卓系统
这儿有类似的问题
https://stackoverflow.com/que...
解决方法就是为每个主题创建一个shape,每个主题的颜色放在color.xml中,shape中使用@color引用