【问题标题】:Error: No resource found that matches the given name (at 'srcCompat' with value '@drawable-hdpi/ic_launcher') in eclispe错误:在 eclispe 中未找到与给定名称匹配的资源(在“srcCompat”,值为“@drawable-hdpi/ic_launcher”)
【发布时间】:2017-07-01 05:28:58
【问题描述】:

我已按照教程调用图像,但我收到此消息错误以使用我的 Eclipse 加载源。我不知道是什么问题。我该如何解决? 这是我的 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" >
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.6">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:
            android:id="@+id/userImg" />
    </LinearLayout>

【问题讨论】:

    标签: java android xml imageview


    【解决方案1】:

    错误:没有找到与给定名称匹配的资源(在 'srcCompat' 具有值'@drawable-hdpi/ic_launcher')

    你应该使用

    android:src="@drawable/your_image"
    

    而不是

    app:srcCompat="@drawable/your_image"
    

    站点说明:如果您一直使用EclipseADT,请注意Android Studio 现在是Android 的官方IDE,因此您应该迁移到Android Studio 以接收所有最新的 IDE 更新。

    Eclipse 中构建的当前项目应该仍然运行良好,但从现在开始,利用新的 Android 功能将变得越来越难。可以使用File&gt;New&gt;Import Project 菜单将项目导入Android Studio

    【讨论】:

    • 它运作良好,谢谢。我会改用android studio。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多