【问题标题】:android eclipse resource image not found in drawable在drawable中找不到android eclipse资源图像
【发布时间】:2011-12-11 12:46:07
【问题描述】:

错误:找不到与给定名称匹配的资源(在“背景”,值为“@drawable/mydroidbg.png”)。

这是我的图像的位置:C:\Users\Rogeross\Documents\ECLIPSE\MyFirstApp\res\drawable-hdpi\mydroidbg.png

这是 main.xml 代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
android:background="@drawable/mydroidbg.png"  //error here
>


<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="TOTO ANDROID" 
    android:gravity="center"
    />

 <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="PRESS ME!!"
    android:textSize="19dp"
    android:textStyle="bold"
     />

    </LinearLayout>

我已经清理,刷新了我的项目,但它仍然看不到我的图像文件...请帮助....

【问题讨论】:

    标签: android eclipse drawable


    【解决方案1】:

    不要提及文件扩展名。使用:

    android:background="@drawable/mydroidbg"
    

    【讨论】:

    • 谢谢伙计...我之前做过但没用...想知道为什么现在可以用...无论如何...再次感谢!
    • @Roj 如果答案解决了你的问题,你应该点击它旁边的勾号接受它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-15
    • 2011-09-02
    • 1970-01-01
    相关资源
    最近更新 更多