ImageView.ScaleType
public
static
final
enum
ImageView.ScaleType
extends Enum<ImageView.ScaleType>
java.lang.Object | ||
↳ | java.lang.Enum<android.widget.ImageView.ScaleType> | |
↳ | android.widget.ImageView.ScaleType |
Options for scaling the bounds of an image to the bounds of this view.
Summary
Enum values | |
---|---|
ImageView.ScaleType |
CENTER
Center the image in the view, but perform no scaling. |
ImageView.ScaleType |
CENTER_CROP
Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). |
ImageView.ScaleType |
CENTER_INSIDE
Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding). |
ImageView.ScaleType |
FIT_CENTER
Scale the image using |
ImageView.ScaleType |
FIT_END
Scale the image using |
ImageView.ScaleType |
FIT_START
Scale the image using |
ImageView.ScaleType |
FIT_XY
Scale the image using |
ImageView.ScaleType |
MATRIX
Scale using the image matrix when drawing. |
Public methods | |
---|---|
static
ImageView.ScaleType
|
valueOf(String name)
|
static
final
ScaleType[]
|
values()
|
Inherited methods | |
---|---|
Enum values
CENTER
public static final ImageView.ScaleType CENTER
Center the image in the view, but perform no scaling.
From XML, use this syntax: android:scaleType="center"
.
CENTER_CROP
public static final ImageView.ScaleType CENTER_CROP
Scale the image uniformly (maintain the image's aspect ratio) so
that both dimensions (width and height) of the image will be equal
to or larger than the corresponding dimension of the view
(minus padding). The image is then centered in the view.
From XML, use this syntax: android:scaleType="centerCrop"
.
CENTER_INSIDE
public static final ImageView.ScaleType CENTER_INSIDE
Scale the image uniformly (maintain the image's aspect ratio) so
that both dimensions (width and height) of the image will be equal
to or less than the corresponding dimension of the view
(minus padding). The image is then centered in the view.
From XML, use this syntax: android:scaleType="centerInside"
.
FIT_CENTER
public static final ImageView.ScaleType FIT_CENTER
Scale the image using Matrix.ScaleToFit#CENTER
.
From XML, use this syntax:
android:scaleType="fitCenter"
.
FIT_END
public static final ImageView.ScaleType FIT_END
Scale the image using Matrix.ScaleToFit#END
.
From XML, use this syntax: android:scaleType="fitEnd"
.
FIT_START
public static final ImageView.ScaleType FIT_START
Scale the image using Matrix.ScaleToFit#START
.
From XML, use this syntax: android:scaleType="fitStart"
.
FIT_XY
public static final ImageView.ScaleType FIT_XY
Scale the image using Matrix.ScaleToFit#FILL
.
From XML, use this syntax: android:scaleType="fitXY"
.
MATRIX
public static final ImageView.ScaleType MATRIX
Scale using the image matrix when drawing. The image matrix can be set using
ImageView#setImageMatrix(Matrix)
. From XML, use this syntax:
android:scaleType="matrix"
.
Public methods
valueOf
public static ImageView.ScaleType valueOf (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
ImageView.ScaleType |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-04 UTC.