# PrimaryLayoutMargins.Companion

Artifact: [androidx.wear.protolayout:protolayout-material3](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/material3/PrimaryLayoutMargins.kt+class:androidx.wear.protolayout.material3.PrimaryLayoutMargins.Companion) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

*** ** * ** ***


```
public static class PrimaryLayoutMargins.Companion
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins` | `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins.Companion#customizedPrimaryLayoutMargin(kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float start, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float end )` Creates new set of margins to be used for `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` customization. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins` | `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins.Companion#customizedPrimaryLayoutMargin(kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float start, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float end, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float bottom )` Creates new set of margins to be used for `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` customization. |

## Public methods

### customizedPrimaryLayoutMargin

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

```
public static final @NonNull PrimaryLayoutMargins customizedPrimaryLayoutMargin(
    @FloatRange(from = 0.0, to = 1.0) float start,
    @FloatRange(from = 0.0, to = 1.0) float end
)
```

Creates new set of margins to be used for `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` customization. The passed in values represent fraction of the screen size.

Top margin is not included as it can't be customized in `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` due to reserved space at the top for the system placed icon.

It is highly recommended to use predefined values instead of creating this custom one, because they are optimized for different screen sizes, content's corners and slots presences. Those predefined ones are:

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MIN_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MID_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#DEFAULT_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MAX_PRIMARY_LAYOUT_MARGIN()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float start` | Fraction of the screen width that should be applied as margin on the start side |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float end` | Fraction of the screen width that should be applied as margin on the end side |

### customizedPrimaryLayoutMargin

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

```
public static final @NonNull PrimaryLayoutMargins customizedPrimaryLayoutMargin(
    @FloatRange(from = 0.0, to = 1.0) float start,
    @FloatRange(from = 0.0, to = 1.0) float end,
    @FloatRange(from = 0.0, to = 1.0) float bottom
)
```

Creates new set of margins to be used for `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` customization. The passed in values represent fraction of the screen size.

Top margin is not included as it can't be customized in `https://developer.android.com/reference/androidx/wear/protolayout/material3/package-summary#(androidx.wear.protolayout.material3.MaterialScope).primaryLayout(kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.protolayout.ModifiersBuilders.Clickable,androidx.wear.protolayout.material3.PrimaryLayoutMargins)` due to reserved space at the top for the system placed icon.

It is highly recommended to use predefined values instead of creating this custom one, because they are optimized for different screen sizes, content's corners and slots presences. Those predefined ones are:

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MIN_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MID_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#DEFAULT_PRIMARY_LAYOUT_MARGIN()`

- `https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MAX_PRIMARY_LAYOUT_MARGIN()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float start` | Fraction of the screen width that should be applied as margin on the start side |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float end` | Fraction of the screen width that should be applied as margin on the end side |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float bottom` | Fraction of the screen height that should be applied as margin on the bottom |