我收到错误消息“无法将 @drawable/12234 转换为可绘制对象”,其中 12234 是我的图像名称,它位于可绘制对象文件夹中。
我可以分配其他较小的图像,但是当我尝试分配此图像时出现错误。
这是我的 Imageview xml 代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:layout_alignParentTop="true"
android:src="@drawable/12234"
android:adjustViewBounds="true"
android:longClickable="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" />
最佳答案
根据文档可绘制资源必须满足以下条件:
基于文件的资源名称只能包含小写的 a-z、0-9 或 _。
而且在您的情况下,它不能全是数字,它必须至少有一个字母。
关于android - 无法将可绘制对象转换为可绘制对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29724519/