ImageView在布局中显示但不在实际设备上显示 [英] ImageView displaying in layout but not on actual device

查看:161
本文介绍了ImageView在布局中显示但不在实际设备上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要显示一个与设备的整个宽度匹配的ImageView,我意识到这样:

I have an ImageView that I want to display matching the full width of the device, I realized that like this:

<ImageView
    android:id="@+id/home_bar_newvault"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:scaleType="centerCrop"
    android:layout_alignParentBottom="true"
    android:src="@drawable/home_bar" />

home_bar是一个PNG图像文件,其大小如下:2399x254。当我选择查看UI的图形布局时,它会在活动的底部正确显示图像视图。但是,当我在我的设备上启动应用程序时,它根本不会显示Imageview。

The home_bar is a PNG image file with the following dimensions: 2399x254. When I choose to view the Graphical Layout of the UI it displays the imageview correctly at the bottom of the activity. However, when I start the application on my device it won't display the Imageview at all.

推荐答案

好吧我试过改变图像的分辨率(将其切成两半使其成为1000x130),并以某种方式修复问题。我认为Android无法直接呈现这样的大图像?我不知道,如果您对该主题有更多了解,请不要犹豫回复!无论如何,缩小图像是有效的。

Alright I've tried changing the resolution of the image (cutting it in half making it 1000x130), and somehow that fixed the problem. I think Android can't render large images like that directly? I don't know, if you know more about the subject please don't hesitate to reply! Anyway, scaling down the image worked.

这篇关于ImageView在布局中显示但不在实际设备上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆