欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android : Resource is not a Drawable (color or path)

程序员文章站 2022-07-01 16:32:21
Android : Resource is not a Drawable (color or path) Caused by: android.content.res.Resources$NotFoundException: Resource "me.samlss.broccoli_demo:drawable/ic_launcher_foreground" (7f060057) is not a Drawable (color or path):关键错误信息:android.content.re...

Android : Resource is not a Drawable (color or path)

 Caused by: android.content.res.Resources$NotFoundException: Resource "me.samlss.broccoli_demo:drawable/ic_launcher_foreground" (7f060057)  is not a Drawable (color or path):

关键错误信息:android.content.res.Resources$NotFoundException  Resource is not a Drawable (color or path)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- TODO: Update blank fragment layout -->
    <EditText
        android:padding="10dp"
        android:background="@drawable/ic_samlss_head_photo"
        android:layout_width="match_parent"
        android:layout_height="40dp" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="200dp">
        <ImageView
            android:id="@+id/image_logo"
            android:layout_centerHorizontal="true"
            android:layout_above="@+id/app_view"
            android:src="@drawable/ic_launcher_foreground"
            android:layout_width="60dp"
            android:layout_height="60dp" />
        <me.samlss.utils.AppView
            android:background="@android:color/holo_blue_dark"
            android:layout_alignParentBottom="true"
            android:id="@+id/app_view"
            android:layout_width="match_parent"
            android:layout_height="100dp" />
    </RelativeLayout>
</LinearLayout>

 

我的drawable-v24中有对应的ic_launcher_foreground图片,但是drawable中是没有ic_launcher_foreground图片的,所以要保证这两个文件夹里都要有布局中引用的图片,直接拷贝过去即可。

本文地址:https://blog.csdn.net/shenggaofei/article/details/107359301