How to display an image full size with ImageView?(如何使用 ImageView 显示全尺寸图像?)
问题描述
当我尝试以全尺寸显示图像时遇到问题.我试图用 wrap_content 显示图像.但它是较小的真实图像.
I have problem when I try to display the image with full size. I tried to display image with wrap_content. But it is smaller real image.
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="QGRyYXdhYmxlL3NjcmVlbjFfbG9nbw==" />
我去这个图像的属性并查看一些信息:尺寸 211 x 74.然后我尝试显示具有固定宽度和高度的图像.我发现它更大了.
I go to the properties of this image and see some information: dimentions 211 x 74. Then I try to display image with fixed width and height. I see it's bigger.
<ImageView
android:layout_width="211px"
android:layout_height="74px"
android:src="QGRyYXdhYmxlL3NjcmVlbjFfbG9nbw==" />
这是正确的方式吗?我们是否必须固定尺寸才能以全尺寸显示图像?请帮我解释和解决这个问题.
is it right way? do we must to fix size to display image with full size? Please help me to explain and resolve this problem.
推荐答案
添加一个 scaleType
到你的 ImageView
add a scaleType
to your ImageView
<ImageView
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="QGRyYXdhYmxlL3NjcmVlbjFfbG9nbw==" />
来自文档 android:scaleType="center"
图像在视图中居中,但不执行缩放.
Center the image in the view, but perform no scaling.
这篇关于如何使用 ImageView 显示全尺寸图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 ImageView 显示全尺寸图像?


- android 4中的android RadioButton问题 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01