android - 给我看 android :src error

标签 android

错误:未找到与给定名称匹配的资源(在“src”处,值为“@drawable-hdpi/ic_launcher”)。为什么会出现此错误?

<TextView 
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable-hdpi/ic_launcher" />
</RelativeLayout>

最佳答案

您不必指定特定的文件夹。系统会根据应用程序运行的屏幕密度加载正确的内容

  android:src="@drawable-hdpi/ic_launcher" 

应该是

 android:src="@drawable/ic_launcher" 

关于android - 给我看 android :src error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27312704/

相关文章:

安卓APK文件: Re-activate older APK file in Google Play Store

android - 在 Air/Android 应用程序上加载模块

java - Android Volley 同步请求不起作用

java - 如何在Android中随机旋转图像?

java - Facebook : posting same status to user wall getting error

android - 在 Android 4.3 中使用“查找我”配置文件

java - 如何在Java android中处理SQLite表的列?

android - 迁移到 Android Studio 后出现 TransformException

android - SQLiteOpenHelper.close() 和 SQLiteDatabase.close() 有什么区别?

android - 通过 Facebook API 将消息发布到别人的墙( friend 的墙)?