我在 Eclipse Kepler 中有一个 android 应用程序,它有一个名为 TheBackground.png 的背景图像。
我将 TheBackground.png 添加到 res/drawable-mdpi,我的 activity_main.xml 以:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/TheBackground.png"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
但 Eclipse 在 android:background 行抛出此错误:
找不到与给定名称匹配的资源(在“背景”,值为“@drawable/TheBackground.png”)
我尝试将 TheBackground.png 添加到所有 res/drawable-*dpi 文件夹,并创建一个 res/drawable 文件夹并将其添加到那里,但它返回相同的错误。
请注意,文件名确实指向有效的 PNG 图像。
我错过了什么吗?