【发布时间】:2017-06-07 17:19:30
【问题描述】:
我将 svg 用于 ImageView 的图标,它可以使用 app:srcCompat 给出,但是当我想将它用于 Buttons 作为选择器时,应用程序崩溃,对于 api 低于 21 的设备,找不到资源异常
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_enabled" android:state_enabled="true" />
<item android:drawable="@drawable/button_disabled" android:state_enabled="false" />
</selector>
其中 button_enabled 和 button_disabled 都是 svg
【问题讨论】:
-
the app crashes with resource not found exception哪个设备和 API 级别? -
抱歉,我会更新我的问题
-
@Superman 它在 api 级别低于 21 时崩溃