ImageView displaying in layout but not on actual device(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 显示在布局中但不在实际设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ImageView 显示在布局中但不在实际设备上
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
