# DimensionBuilders.ProportionalDimensionProp

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/DimensionBuilders.java+class:androidx.wear.protolayout.DimensionBuilders.ProportionalDimensionProp) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
@RequiresSchemaVersion(major = 1, minor = 0)
public final class DimensionBuilders.ProportionalDimensionProp implements DimensionBuilders.ImageDimension
```

<br />

*** ** * ** ***

A type for a dimension that scales itself proportionally to another dimension such that the aspect ratio defined by the given width and height values is preserved.

Note that the width and height are unitless; only their ratio is relevant. This allows for specifying an element's size using common ratios (e.g. width=4, height=3), or to allow an element to be resized proportionally based on the size of an underlying asset (e.g. an 800x600 image being added to a smaller container and resized accordingly).

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ProportionalDimensionProp.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ProportionalDimensionProp`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ProportionalDimensionProp#getAspectRatioHeight()()` Gets the height to be used when calculating the aspect ratio ratio to preserve. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ProportionalDimensionProp#getAspectRatioWidth()()` Gets the width to be used when calculating the aspect ratio to preserve. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ProportionalDimensionProp#toString()()` |

## Public methods

### getAspectRatioHeight

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @IntRange(from = 0) int getAspectRatioHeight()
```

Gets the height to be used when calculating the aspect ratio ratio to preserve.

### getAspectRatioWidth

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @IntRange(from = 0) int getAspectRatioWidth()
```

Gets the width to be used when calculating the aspect ratio to preserve.

### toString

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