# AspectRatioFrameLayout.AspectRatioListener

# AspectRatioFrameLayout.AspectRatioListener

Artifact:[androidx.media3:media3-ui](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/ui/AspectRatioFrameLayout.java+class:androidx.media3.ui.AspectRatioFrameLayout.AspectRatioListener)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/ui/AspectRatioFrameLayout.AspectRatioListener "View this page in Java")

<br />

```
interface AspectRatioFrameLayout.AspectRatioListener
```

<br />

*** ** * ** ***

Listener to be notified about changes of the aspect ratios of this view.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onAspectRatioUpdated](https://developer.android.com/reference/kotlin/androidx/media3/ui/AspectRatioFrameLayout.AspectRatioListener#onAspectRatioUpdated(float,float,boolean))`(` ` targetAspectRatio: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` naturalAspectRatio: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` aspectRatioMismatch: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) `)` Called when either the target aspect ratio or the view aspect ratio is updated. |

## Public functions

### onAspectRatioUpdated

```
fun onAspectRatioUpdated(
    targetAspectRatio: Float,
    naturalAspectRatio: Float,
    aspectRatioMismatch: Boolean
): Unit
```

Called when either the target aspect ratio or the view aspect ratio is updated.  

|                                                 Parameters                                                 |
|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `targetAspectRatio: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)       | The aspect ratio that has been set in[setAspectRatio](https://developer.android.com/reference/kotlin/androidx/media3/ui/AspectRatioFrameLayout#setAspectRatio(float)) |
| `naturalAspectRatio: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)      | The natural aspect ratio of this view (before its width and height are modified to satisfy the target aspect ratio).                                                  |
| `aspectRatioMismatch: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the target and natural aspect ratios differ enough for changing the resize mode to have an effect.                                                            |