我如何prevent比例在Android中的ImageView? [英] How do I prevent scaling in Android Imageview?

查看:132
本文介绍了我如何prevent比例在Android中的ImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个形象,是480像素×40像素。我想显示此图像的ImageView的,而无需将其缩放以适应。

I have an image that is 480 pixels by 40 pixels. I would like to show this image in an ImageView without having it scale to fit.

例如:如果我的屏幕只有宽320宽,我只会宽320图像喜欢在屏幕上显示,而不是把它填满自己变成了ImageView的(即使这意味着图像的其余部分被切断)。

Ex: If my screen is only 320pixels wide I would like only 320pixels of the image to show on the screen, not have it cram itself into the ImageView (even if it means that the rest of the image gets cut off).

有没有一种方法,以prevent它扩展到合适?

Is there a way to prevent it from scaling to fit?

编辑:另外,我想图像左侧排队与设备的屏幕的左侧

Also, I would like the left side of the image to line up with the left side of the device's screen.

感谢

推荐答案

使用 ScaleType.CENTER ,像这样的XML:

Use ScaleType.CENTER, like this in XML:

android:scaleType="center"

这将居中图像中的观点,但不进行任何缩放

This will "center the image in the view, but perform no scaling"

在这里阅读更多:<一href="http://developer.android.com/reference/android/widget/ImageView.ScaleType.html">http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

(这是顺便把第一次打在谷歌搜索ImageView的规模)

(This is by the way the first hit on googling "imageview scale")

这篇关于我如何prevent比例在Android中的ImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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