Added in API level 1

ScaleType


class ScaleType
kotlin.Any
   ↳ kotlin.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

Center the image in the view, but perform no scaling.

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).

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).

Scale the image using Matrix.ScaleToFit#CENTER.

Scale the image using Matrix.ScaleToFit#END.

Scale the image using Matrix.ScaleToFit#START.

Scale the image using Matrix.ScaleToFit#FILL.

Scale using the image matrix when drawing.

Enum values

CENTER

Added in API level 1
enum val CENTER : ImageView.ScaleType

Center the image in the view, but perform no scaling. From XML, use this syntax: android:scaleType="center".

CENTER_CROP

Added in API level 1
enum val CENTER_CROP : ImageView.ScaleType

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

Added in API level 1
enum val CENTER_INSIDE : ImageView.ScaleType

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

Added in API level 1
enum val FIT_CENTER : ImageView.ScaleType

Scale the image using Matrix.ScaleToFit#CENTER. From XML, use this syntax: android:scaleType="fitCenter".

FIT_END

Added in API level 1
enum val FIT_END : ImageView.ScaleType

Scale the image using Matrix.ScaleToFit#END. From XML, use this syntax: android:scaleType="fitEnd".

FIT_START

Added in API level 1
enum val FIT_START : ImageView.ScaleType

Scale the image using Matrix.ScaleToFit#START. From XML, use this syntax: android:scaleType="fitStart".

FIT_XY

Added in API level 1
enum val FIT_XY : ImageView.ScaleType

Scale the image using Matrix.ScaleToFit#FILL. From XML, use this syntax: android:scaleType="fitXY".

MATRIX

Added in API level 1
enum val MATRIX : ImageView.ScaleType

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".