ImageView.SetMaxWidth(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An optional argument to supply a maximum width for this view.
[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
Parameters
- maxWidth
- Int32
maximum width for this view
- Attributes
Remarks
An optional argument to supply a maximum width 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.setMaxWidth(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.