Android的ImageView的ScaleType和项目高度 [英] Android ImageView ScaleType and item height

查看:177
本文介绍了Android的ImageView的ScaleType和项目高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

事情看起来很简单,第一,但最终的结果并不好。 我有比屏幕的宽度大的宽度的图像。所以,我需要向下扩展它在我的ImageView的。我查了一下ScaleType选择和尝试所有这些,但没有一个是好的。首页中心只显示为中心的布局图像,不结垢完成。 fitCenter进行调整以适合在我的布局中的图像,但有一个很大的缺点:该项目的高度保持,因为这将有大的图像在里面。看一看在附加的图像的第二个屏幕。我怎么可以强制列表项,减少它的高度来包装文本和图像?

Things looked quite simple first but in the end the result is not good. I have an image which has a width larger than screen's width. So I need to scale it down in my imageview. I looked over the ScaleType options and tried them all but none is ok. First "center" only displays the image centered on the layout, no scaling done. "fitCenter" scales the image to fit in my layout but has a major drawback: the height of the item remains as it would have the large image in it. Take a look at the second screen in the attached image. How can I force the list item, to reduce its height to wrap both the text and the image ?

推荐答案

使用这似乎最好的给你(我猜你喜欢什么你fitCenter看到)的scaletype。额外的事情,你必须做的是

Use the scaletype which seems best to you ( I guess you like what you see with fitCenter). The additional thing that you must do is

安卓adjustViewBounds =真正的

android:adjustViewBounds="true"

在您的ImageView。

in your ImageView.

或者你可以去FitXY但有时效果不正是你想要的。

or you could go with FitXY but sometimes the result is not exactly what you want.

这篇关于Android的ImageView的ScaleType和项目高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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