ImageView 显示在布局中但不在实际设备上

ImageView displaying in layout but not on actual device(ImageView 显示在布局中但不在实际设备上)
本文介绍了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 显示在布局中但不在实际设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)