如何创建,填补了家长的高度和显示图像尽可能大的ImageView的? [英] How to create an ImageView that fills the parent height and displays an Image as big as possible?

查看:133
本文介绍了如何创建,填补了家长的高度和显示图像尽可能大的ImageView的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个是通过以下方式定义的ImageView的:

I have an ImageView that is defined in the following way:

 <ImageView
  android:id="@+id/cover_view"
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  android:layout_below="@id/title"
  android:layout_above="@id/divider"
  android:adjustViewBounds="true"
  android:src="@drawable/image_placeholder"
  android:scaleType="fitStart"/>

现在下载一个新的位图后,我改变了绘制。图像现在出现在的ImageView的左上角。有没有办法让图像填满整个高度有可能再调整视图的宽度,使缩放图像不改变ascpect比例是多少?

Now after downloading a new bitmap I change the drawable. The image now appears in the top left corner of the ImageView. Is there a way to have the image fill up the whole height that is possible and then adjust the width of the view to enable scaling the image without changing the ascpect ratio?

图片填满一个标准的屏幕,但在WVGA分辨率的图像只​​需约一半的ImageView的实际高度的所有空间。

The image fills up all the space on a standard screen but on a WVGA Resolution the image takes only about half of the actual height of the ImageView.

推荐答案

基本上这里的答案是,有没有predefined你所要达到什么样的价值。该解决方案是创建一个 矩阵 适合您的需求和呼叫<一href="http://developer.android.com/reference/android/widget/ImageView.html#setImageMatrix%28android.graphics.Matrix%29"相对=nofollow> setImageMatrix(矩阵) 你的的ImageView

Basically the answer here is that there is no predefined value for what you are trying to achieve. The solution is to create a Matrix that fits to your needs and call setImageMatrix(matrix) on your ImageView.

这篇关于如何创建,填补了家长的高度和显示图像尽可能大的ImageView的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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