简体   繁体   English

ImageView图像未在Eclipse + Android上显示

[英]ImageView image not showing on Eclipse + Android

I have all my pictures saved in the drawable-xhdpi folder. 我的所有图片都保存在drawable-xhdpi文件夹中。 I have a total of six images, it shows 4 but not the last two despite me using the same code for both in the xml file. 我总共有六个图像,尽管我在xml文件中为两个图像使用了相同的代码,但它显示了4个图像,但没有显示最后两个图像。

 <ImageView
            android:id="@+id/button4"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_above="@+id/textView4"
            android:layout_alignRight="@+id/textView4"
            android:onClick="food"
            android:src="@drawable/foods" /> 

^ That one is viewable ^那是可见的

<ImageView
            android:id="@+id/button6"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignBaseline="@+id/button5"
            android:layout_alignBottom="@+id/button5"
            android:layout_alignRight="@+id/textView4"
            android:onClick="parking"
            android:src="@drawable/parking" />

^ This one isn't. ^这不是。

This is what I get when viewing through Graphical Layout 这是我通过图形布局查看时得到的

The following classes could not be found: 找不到以下类别:
- ImageView (Change to android.widget.ImageView, Fix Build Path, Edit XML) -ImageView(更改为android.widget.ImageView,修复构建路径,编辑XML)

Again, both images are contained within the same folder. 同样,两个图像都包含在同一文件夹中。 It might be obvious, I'm relatively new to android. 显而易见,我是android的新手。

Go to Project -> Clean... from the top bar in eclipse. 在Eclipse的顶部栏中,转到Project > Clean... Then a good old restart of the graphical view might help as well. 然后,重新启动图形视图可能会有所帮助。

i faced same problem , if you are using image saved .icon extension it may cause this problem. 我遇到了同样的问题,如果您使用的是图像保存的.icon扩展名,则可能会导致此问题。 change your image type. 更改您的图像类型。 hope this help. 希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM