我有一个形象,是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"
在这里阅读更多:developer.android/reference/android/widget/ImageView.ScaleType.html
(这是顺便把第一次打在谷歌搜索ImageView的规模)
(This is by the way the first hit on googling "imageview scale")
更多推荐
我如何prevent比例在Android中的ImageView?
发布评论