gpt4 book ai didi

android - 空 Vector Drawable 在运行时导致 ResourceNotFound 异常

转载 作者:太空狗 更新时间:2023-10-29 13:04:07 26 4
gpt4 key购买 nike

我不能使用可绘制的空矢量作为占位符:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="164.891"
android:viewportHeight="75.543"
android:width="164.891dp"
android:height="75.543dp"></vector>

Android Studio 没有指出 Activity 预览中的任何渲染问题,但在运行时我遇到了这个致命异常:

Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class ImageView
Caused by: android.content.res.Resources$NotFoundException: Drawable com.xxxx.yyyy:drawable/product_logo_image with resource ID #0x7f080121
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/product_logo_image.xml from drawable resource ID #0x7f080121

最佳答案

已更新

你的向量中没有路径,添加一个不绘制任何东西的路径应该可以修复错误

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="dp"
android:height="1dp"
android:viewportWidth="1"
android:viewportHeight="1">

<path
android:pathData="M0,0Z"
android:fillColor="#ffffff"/>

</vector>

关于android - 空 Vector Drawable 在运行时导致 ResourceNotFound 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50741250/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com