ImageView.SetMaxWidth(Int32) 方法

定义

用于为此视图提供最大宽度的可选参数。

[Android.Runtime.Register("setMaxWidth", "(I)V", "GetSetMaxWidth_IHandler")]
public virtual void SetMaxWidth(int maxWidth);
[<Android.Runtime.Register("setMaxWidth", "(I)V", "GetSetMaxWidth_IHandler")>]
abstract member SetMaxWidth : int -> unit
override this.SetMaxWidth : int -> unit

参数

maxWidth
Int32

此视图的最大宽度

属性

注解

用于为此视图提供最大宽度的可选参数。 仅当设置为 true 时才 #setAdjustViewBounds(boolean) 有效。 若要将图像设置为最大 100 x 100,同时保留原始纵横比,请执行以下操作:1) 将 adjustViewBounds 设置为 true 2)将 maxWidth 和 maxHeight 设置为 100 3)将高度和宽度布局参数设置为WRAP_CONTENT。

请注意,如果原始图像较小,此视图可能仍小于 100 x 100。 若要将图像设置为固定大小,请在布局参数中指定该大小,然后用于 #setScaleType(android.widget.ImageView.ScaleType) 确定如何在边界内拟合图像。

Java文档android.widget.ImageView.setMaxWidth(int)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

另请参阅