[英]Eclipse ADT (android Pugin) refuses to find images in drawable folder
Off the bat, version information: 蝙蝠,版本信息:
There are many, many questions on SO regarding the various res/drawable
folders (standard, drawable-hdpi
, -mdpi
, -ldpi
, -xhdpi
) and on whether it's necessary to create the standard drawable folder if it doesn't exist, where Android/ADT/Eclipse will look for the @drawable/*
files, etc. However, my question seems to not have been answered thus far. 关于各种res/drawable
文件夹(标准, drawable-hdpi
, -mdpi
, -ldpi
, -xhdpi
)以及是否有必要创建标准drawable文件夹(如果它不存在)有很多很多问题,其中Android / ADT / Eclipse将查找@drawable/*
文件等。但是,到目前为止我的问题似乎还未得到解答。
It's a pretty striaghtforward problem. 这是一个非常严格的问题。 To put it simply, I placed a file name 'starbg.png' in my drawable-hdpi
folder, then used the qualifier @drawable/starbg.png
in a layout xml
file. 简单地说,我在drawable-hdpi
文件夹中放置了一个文件名'starbg.png',然后在布局xml
文件中使用限定符@drawable/starbg.png
。 However, Eclipse is throwing an error: 但是,Eclipse正在抛出一个错误:
error: Error: No resource found that matches the given name (at 'background'
with value '@drawable/starbg.png').
Why? 为什么? Unsure. 不确定。 I have tried the following solutions based on SO questions, all without success: 我已经尝试了基于SO问题的以下解决方案,但都没有成功:
res/drawable
folder (as one was not auto-generated by my version of ADT) and adding the image there 创建res/drawable
文件夹(因为我的ADT版本没有自动生成)并在那里添加图像 star_bg.png
将文件重命名为star_bg.png
The project is not complicated. 该项目并不复杂。 It's an incredibly simple setup, with 2 views, one of which has nothing more than a LinearLayout
with an android:background
attribute (with layout and orientation info, of course), the other of which works like a charm. 这是一个非常简单的设置,有2个视图,其中一个只有一个带有android:background
属性的LinearLayout
(当然还有布局和方向信息),另一个就像魅力一样。
So I'm stumped. 所以我很难过。 Any help is hugely appreciated. 任何帮助都非常感谢。
when you specify your resource, it should not include the file extension. 指定资源时,不应包含文件扩展名。 that is, a resource file, 也就是说,一个资源文件,
drawable/starbg.png
should be referenced as, 应该被引用为,
@drawable/starbg
eg, 例如,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/starbg"
...>
...
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.