未找到修复drawableStart资源API 19
今天尝试在Android上运行 4.4 (API 19) 然后是故障 找不到drawableStart资源 API 19 服用drawableStart为TextView的:
android.content.res.Resources $ NotFoundException: 可绘制资源ID#0x7f020中的文件res / drawable / ic_add.xml
我签入了具有矢量支持的build.gradle文件,如下所示,但仍在拖动:
android { defaultConfig { vectorDrawables.useSupportLibrary = true } }
最后,我通过使用库版本1.1.0-alpha01程序兼容性克服 (或更高版本)
履行 “androidx.appcompat:程序兼容性:1.1.0-alpha01”
然后将TextView替换为 AppCompatTextView, 并将drawableStart替换为 drawableStartCompat
<androidx.appcompat.widget.AppCompatTextView android:id="@+id/tvIconSearch" android:layout_width="wrap_content" android:layout_height="22dp" android:background="@drawable/home_header_search_icon_bg_style" android:padding="6dp" app:drawableStartCompat="@drawable/ic_add" />
最新评论