Share via


ImageView.SetMaxHeight(Int32) Method

Definition

An optional argument to supply a maximum height for this view.

[Android.Runtime.Register("setMaxHeight", "(I)V", "GetSetMaxHeight_IHandler")]
public virtual void SetMaxHeight (int maxHeight);
[<Android.Runtime.Register("setMaxHeight", "(I)V", "GetSetMaxHeight_IHandler")>]
abstract member SetMaxHeight : int -> unit
override this.SetMaxHeight : int -> unit

Parameters

maxHeight
Int32

maximum height for this view

Attributes

Remarks

An optional argument to supply a maximum height for this view. Only valid if #setAdjustViewBounds(boolean) has been set to true. To set an image to be a maximum of 100 x 100 while preserving the original aspect ratio, do the following: 1) set adjustViewBounds to true 2) set maxWidth and maxHeight to 100 3) set the height and width layout params to WRAP_CONTENT.

Note that this view could be still smaller than 100 x 100 using this approach if the original image is small. To set an image to a fixed size, specify that size in the layout params and then use #setScaleType(android.widget.ImageView.ScaleType) to determine how to fit the image within the bounds.

Java documentation for android.widget.ImageView.setMaxHeight(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also