# PrimaryLayoutMargins

# PrimaryLayoutMargins

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)  
Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/protolayout/material3/PrimaryLayoutMargins "View this page in Java")

<br />

```
abstract class PrimaryLayoutMargins
```

<br />

*** ** * ** ***

The set of margins for the[primaryLayout](https://developer.android.com/reference/kotlin/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))'s customization, represented as fraction of the screen size.

It is highly recommended to use these predefined values that are optimized for different screen sizes, content's corners and slots presences. Those are:

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

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

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

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

## Summary

|                                                 ### Public companion functions                                                  |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [customizedPrimaryLayoutMargin](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#customizedPrimaryLayoutMargin(kotlin.Float,kotlin.Float))`(` ` start: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` end: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` Creates new set of margins to be used for[primaryLayout](https://developer.android.com/reference/kotlin/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.                                                                                                                                                                                                                                 |
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [customizedPrimaryLayoutMargin](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#customizedPrimaryLayoutMargin(kotlin.Float,kotlin.Float,kotlin.Float))`(` ` start: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` end: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` bottom: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` Creates new set of margins to be used for[primaryLayout](https://developer.android.com/reference/kotlin/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 companion properties                                                 |
|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [DEFAULT_PRIMARY_LAYOUT_MARGIN](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#DEFAULT_PRIMARY_LAYOUT_MARGIN()) Default side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that works for the majority of[Shapes](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes)inside the main content components, usually across round toward medium round corners.                                           |
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [MAX_PRIMARY_LAYOUT_MARGIN](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MAX_PRIMARY_LAYOUT_MARGIN()) Max side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used when the main slot contains content components with square corners, for example, smaller than[Shapes.medium](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#medium())to avoid clipping.                       |
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [MID_PRIMARY_LAYOUT_MARGIN](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MID_PRIMARY_LAYOUT_MARGIN()) Mid side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used when the main slot contains content components with fully rounded to medium round corners, for example, larger than[Shapes.medium](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#medium())to avoid clipping. |
| [PrimaryLayoutMargins](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins) | [MIN_PRIMARY_LAYOUT_MARGIN](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/PrimaryLayoutMargins#MIN_PRIMARY_LAYOUT_MARGIN()) Min side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used only when the main slot contains content components with fully rounded corners, such as[Shapes.full](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#full())to avoid clipping.                                 |

## Public companion functions

### customizedPrimaryLayoutMargin

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

```
fun customizedPrimaryLayoutMargin(
    start: @FloatRange(from = 0.0, to = 1.0) Float,
    end: @FloatRange(from = 0.0, to = 1.0) Float
): PrimaryLayoutMargins
```

Creates new set of margins to be used for[primaryLayout](https://developer.android.com/reference/kotlin/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[primaryLayout](https://developer.android.com/reference/kotlin/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:

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

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

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

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

|                                                                                                  Parameters                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| `start: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Fraction of the screen width that should be applied as margin on the start side |
| `end: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)   | 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)  

```
fun customizedPrimaryLayoutMargin(
    start: @FloatRange(from = 0.0, to = 1.0) Float,
    end: @FloatRange(from = 0.0, to = 1.0) Float,
    bottom: @FloatRange(from = 0.0, to = 1.0) Float
): PrimaryLayoutMargins
```

Creates new set of margins to be used for[primaryLayout](https://developer.android.com/reference/kotlin/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[primaryLayout](https://developer.android.com/reference/kotlin/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:

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

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

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

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

|                                                                                                   Parameters                                                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| `start: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)  | Fraction of the screen width that should be applied as margin on the start side |
| `end: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)    | Fraction of the screen width that should be applied as margin on the end side   |
| `bottom: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Fraction of the screen height that should be applied as margin on the bottom    |

## Public companion properties

### DEFAULT_PRIMARY_LAYOUT_MARGIN

```
val DEFAULT_PRIMARY_LAYOUT_MARGIN: PrimaryLayoutMargins
```

Default side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that works for the majority of[Shapes](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes)inside the main content components, usually across round toward medium round corners.

The actual returned values depend on presence of slots in[primaryLayout](https://developer.android.com/reference/kotlin/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))which will be applied automatically.  

### MAX_PRIMARY_LAYOUT_MARGIN

```
val MAX_PRIMARY_LAYOUT_MARGIN: PrimaryLayoutMargins
```

Max side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used when the main slot contains content components with square corners, for example, smaller than[Shapes.medium](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#medium())to avoid clipping.

The actual returned values depend on presence of slots in[primaryLayout](https://developer.android.com/reference/kotlin/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))which will be applied automatically.  

### MID_PRIMARY_LAYOUT_MARGIN

```
val MID_PRIMARY_LAYOUT_MARGIN: PrimaryLayoutMargins
```

Mid side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used when the main slot contains content components with fully rounded to medium round corners, for example, larger than[Shapes.medium](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#medium())to avoid clipping.

The actual returned values depend on presence of slots in[primaryLayout](https://developer.android.com/reference/kotlin/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))which will be applied automatically.  

### MIN_PRIMARY_LAYOUT_MARGIN

```
val MIN_PRIMARY_LAYOUT_MARGIN: PrimaryLayoutMargins
```

Min side margins for the main slot of[primaryLayout](https://developer.android.com/reference/kotlin/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))that should be used only when the main slot contains content components with fully rounded corners, such as[Shapes.full](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material3/Shapes#full())to avoid clipping.

The actual returned values depend on presence of slots in[primaryLayout](https://developer.android.com/reference/kotlin/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))which will be applied automatically.