我ImageView
有app:srcCompat="@drawable/my_app_img"
我得到:
android.content.res.Resources$NotFoundException 文件 res/drawable/$my_app_img__0.xml 来自颜色状态列表资源 ID #0x7f07000a
在 Android 6 上,不要在 8 及更高版本上获得它。
这是my_app_img.xml
:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
android:width="73dp"
android:height="103dp"
android:viewportWidth="73"
android:viewportHeight="103">
<path
android:fillAlpha="0"
android:fillColor="#000000"
android:pathData="M0,0l72.299,0l0,103l-72.299,0z" />
<path android:pathData="M70.379,96.761L40.602,56.464L25.724,77.276C22.268,82.111 22.324,88.62 25.864,93.394L28.417,96.839C31.291,100.714 35.832,103 40.659,103H67.227C70.442,103 72.288,99.345 70.379,96.761Z">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#FF094EC2"
android:endX="31.7222"
android:endY="68.3161"
android:startColor="#FF005AF4"
android:startX="57.4428"
android:startY="104.487"
android:type="linear"
tools:targetApi="n" />
</aapt:attr>
</path>
<path android:pathData="M68.592,0H38.75C36.254,0 33.907,1.188 32.431,3.199L2.949,43.369C-0.919,48.64 -0.988,55.79 2.778,61.134L19.001,84.156C19.001,80.833 20.044,77.594 21.984,74.895L71.598,5.853C73.355,3.407 71.606,0 68.592,0Z">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#FF29EEFD"
android:endX="32.6558"
android:endY="31.6712"
android:startColor="#FF2EB3ED"
android:startX="6.53102"
android:startY="64.8591"
android:type="linear" />
</aapt:attr>
</path>
</vector>
我也使用:
vectorDrawables.useSupportLibrary = true