# ImageView.ScaleType

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ScaleType

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/widget/ImageView.ScaleType "View this page in Java")  

```
class ScaleType
```

|---|---|--------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                              |||
| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\<[android.widget.ImageView.ScaleType](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#)\> ||
|   | ↳ | [android.widget.ImageView.ScaleType](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#) |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [ImageView.ScaleType.CENTER](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:CENTER),[ImageView.ScaleType.CENTER_CROP](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:CENTER_CROP),[ImageView.ScaleType.CENTER_INSIDE](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:CENTER_INSIDE),[ImageView.ScaleType.FIT_CENTER](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_CENTER),[ImageView.ScaleType.FIT_END](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_END),[ImageView.ScaleType.FIT_START](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_START),[ImageView.ScaleType.FIT_XY](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_XY),[ImageView.ScaleType.MATRIX](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:MATRIX) |-------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ImageView.ScaleType.CENTER](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:CENTER)               | Center the image in the view, but perform no scaling.                                                                                                                                                          | | [ImageView.ScaleType.CENTER_CROP](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE: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](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE: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](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_CENTER)       | Scale the image using[Matrix.ScaleToFit.CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                      | | [ImageView.ScaleType.FIT_END](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_END)             | Scale the image using[Matrix.ScaleToFit.END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                         | | [ImageView.ScaleType.FIT_START](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_START)         | Scale the image using[Matrix.ScaleToFit.START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                       | | [ImageView.ScaleType.FIT_XY](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_XY)               | Scale the image using[Matrix.ScaleToFit.FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                        | | [ImageView.ScaleType.MATRIX](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:MATRIX)               | Scale using the image matrix when drawing.                                                                                                                                                                     | |

Options for scaling the bounds of an image to the bounds of this view.

## Summary

|                                                                                                                                                                 Enum values                                                                                                                                                                 ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CENTER](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:CENTER) Center the image in the view, but perform no scaling.                                                                                                                                                                      |
| [CENTER_CROP](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE: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).   |
| [CENTER_INSIDE](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE: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). |
| [FIT_CENTER](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_CENTER) Scale the image using[Matrix.ScaleToFit.CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                          |
| [FIT_END](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_END) Scale the image using[Matrix.ScaleToFit.END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                                   |
| [FIT_START](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_START) Scale the image using[Matrix.ScaleToFit.START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                             |
| [FIT_XY](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:FIT_XY) Scale the image using[Matrix.ScaleToFit.FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#).                                                                                    |
| [MATRIX](https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType#ENUM_VALUE:MATRIX) Scale using the image matrix when drawing.                                                                                                                                                                                 |

## Enum values

### CENTER

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val FIT_CENTER : ImageView.ScaleType
```

Scale the image using[Matrix.ScaleToFit.CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#). From XML, use this syntax:`android:scaleType="fitCenter"`.  

### FIT_END

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val FIT_END : ImageView.ScaleType
```

Scale the image using[Matrix.ScaleToFit.END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#). From XML, use this syntax:`android:scaleType="fitEnd"`.  

### FIT_START

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val FIT_START : ImageView.ScaleType
```

Scale the image using[Matrix.ScaleToFit.START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#). From XML, use this syntax:`android:scaleType="fitStart"`.  

### FIT_XY

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val FIT_XY : ImageView.ScaleType
```

Scale the image using[Matrix.ScaleToFit.FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit.html#). From XML, use this syntax:`android:scaleType="fitXY"`.  

### MATRIX

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val MATRIX : ImageView.ScaleType
```

Scale using the image matrix when drawing. The image matrix can be set using[ImageView.setImageMatrix(Matrix)](https://developer.android.com/reference/kotlin/android/widget/ImageView#setImageMatrix(android.graphics.Matrix)). From XML, use this syntax:`android:scaleType="matrix"`.