# EmbeddingAspectRatio

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/embedding/EmbeddingAspectRatio.kt+class:androidx.window.embedding.EmbeddingAspectRatio) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

*** ** * ** ***


```
public final class EmbeddingAspectRatio
```

<br />

*** ** * ** ***

The aspect ratio of the parent window bound to allow embedding with the rule.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitRule#maxAspectRatioInPortrait()` |   |
| `https://developer.android.com/reference/androidx/window/embedding/SplitRule#maxAspectRatioInLandscape()` |   |

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_ALLOW()` Gets the special `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` to represent it always allows embedding. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_DISALLOW()` Gets the special `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` to represent it always disallows embedding. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `int` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#hashCode()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ratio(kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 1.0, fromInclusive = false) float ratio)` For max aspect ratio, when the aspect ratio is greater than this value, it means to disallow embedding. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#toString()()` |

## Public fields

### ALWAYS_ALLOW

```
public static final @NonNull EmbeddingAspectRatio ALWAYS_ALLOW
```

Gets the special `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` to represent it always allows embedding.

An example use case is to set it on `https://developer.android.com/reference/androidx/window/embedding/SplitRule#maxAspectRatioInLandscape()` if the app wants to always allow embedding as split when the parent window is in landscape.

### ALWAYS_DISALLOW

```
public static final @NonNull EmbeddingAspectRatio ALWAYS_DISALLOW
```

Gets the special `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` to represent it always disallows embedding.

An example use case is to set it on `https://developer.android.com/reference/androidx/window/embedding/SplitRule#maxAspectRatioInPortrait()` if the app wants to disallow embedding as split when the parent window is in portrait.

## Public methods

### equals

```
public boolean equals(Object other)
```

### hashCode

```
public int hashCode()
```

### ratio

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public static final @NonNull EmbeddingAspectRatio ratio(@FloatRange(from = 1.0, fromInclusive = false) float ratio)
```

For max aspect ratio, when the aspect ratio is greater than this value, it means to disallow embedding.

For min aspect ratio, when the aspect ratio is smaller than this value, it means to disallow embedding.

Values smaller than or equal to `1` are invalid.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 1.0, fromInclusive = false) float ratio` | the aspect ratio. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` | the `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio` representing the `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ratio(kotlin.Float)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_ALLOW()` | for always allow embedding. |
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_DISALLOW()` | for always disallow embedding. |

### toString

```
public @NonNull String toString()
```