# PreviewView.ScaleType

Artifact: [androidx.camera:camera-view](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/view/PreviewView.java+class:androidx.camera.view.PreviewView.ScaleType) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***


```
enum PreviewView.ScaleType
```

<br />

*** ** * ** ***

Options for scaling the preview vis-à-vis its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FILL_CENTER` | Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and center it in the view. |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FILL_END` | Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the end of the view, which is the bottom right corner in a left-to-right (LTR) layout, or the bottom left corner in a right-to-left (RTL) layout. |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FILL_START` | Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the start of the view, which is the top left corner in a left-to-right (LTR) layout, or the top right corner in a right-to-left (RTL) layout. |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FIT_CENTER` | Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and center it inside the view. |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FIT_END` | Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the end of the view, which is the bottom right corner in a left-to-right (LTR) layout, or the bottom left corner in a right-to-left (RTL) layout. |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#FIT_START` | Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the start of the view, which is the top left corner in a left-to-right (LTR) layout, or the top right corner in a right-to-left (RTL) layout. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType!` | `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#valueOf(java.lang.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns the enum constant of this type with the specified name. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType!>!` | `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### FILL_CENTER

```
val PreviewView.ScaleType.FILL_CENTER: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and center it in the view.

This may cause the preview to be cropped if the camera preview aspect ratio does not match that of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

### FILL_END

```
val PreviewView.ScaleType.FILL_END: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the end of the view, which is the bottom right corner in a left-to-right (LTR) layout, or the bottom left corner in a right-to-left (RTL) layout.

This may cause the preview to be cropped if the camera preview aspect ratio does not match that of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

### FILL_START

```
val PreviewView.ScaleType.FILL_START: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it fills the entire `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the start of the view, which is the top left corner in a left-to-right (LTR) layout, or the top right corner in a right-to-left (RTL) layout.

This may cause the preview to be cropped if the camera preview aspect ratio does not match that of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

### FIT_CENTER

```
val PreviewView.ScaleType.FIT_CENTER: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and center it inside the view. The background area not covered by the preview stream will be black or the background of the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

Both dimensions of the preview will be equal or less than the corresponding dimensions of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

### FIT_END

```
val PreviewView.ScaleType.FIT_END: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the end of the view, which is the bottom right corner in a left-to-right (LTR) layout, or the bottom left corner in a right-to-left (RTL) layout. The background area not covered by the preview stream will be black or the background of the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

Both dimensions of the preview will be equal or less than the corresponding dimensions of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

### FIT_START

```
val PreviewView.ScaleType.FIT_START: PreviewView.ScaleType
```

Scale the preview, maintaining the source aspect ratio, so it is entirely contained within the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`, and align it to the start of the view, which is the top left corner in a left-to-right (LTR) layout, or the top right corner in a right-to-left (RTL) layout. The background area not covered by the preview stream will be black or the background of the `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`

Both dimensions of the preview will be equal or less than the corresponding dimensions of its container `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView`.

## Public functions

### valueOf

Added in 1.1.0

```
java-static fun valueOf(name: String!): PreviewView.ScaleType!
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType!` | the enum constant with the specified name |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if this enum type has no constant with the specified name |

### values

Added in 1.1.0

```
java-static fun values(): Array<PreviewView.ScaleType!>!
```

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/camera/view/PreviewView.ScaleType!>!` | an array containing the constants of this enum type, in the order they're declared |