# SplitAttributes.Builder

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

*** ** * ** ***


```
public final class SplitAttributes.Builder
```

<br />

*** ** * ** ***

Builder for creating an instance of `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes`.

- The default split type is an equal split between primary and secondary containers.

- The default layout direction is based on locale.

- The default animation params is to use the current theme window background color and system transitions.

- The default divider attributes is not to use divider.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes` | `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#build()()` Builds a `SplitAttributes` instance with the attributes specified by `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setSplitType(androidx.window.embedding.SplitAttributes.SplitType)`, `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setLayoutDirection(androidx.window.embedding.SplitAttributes.LayoutDirection)`, and `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setAnimationParams(androidx.window.embedding.EmbeddingAnimationParams)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 5) https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setAnimationParams(androidx.window.embedding.EmbeddingAnimationParams)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAnimationParams params)` Sets the animation params to use during animation of the split involving this `SplitAttributes` object if the animation requires a background color or non-default transitions. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setDividerAttributes(androidx.window.embedding.DividerAttributes)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes dividerAttributes)` Sets the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes` for this split. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setLayoutDirection(androidx.window.embedding.SplitAttributes.LayoutDirection)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.LayoutDirection layoutDirection )` Sets the split layout direction attribute. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setSplitType(androidx.window.embedding.SplitAttributes.SplitType)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.SplitType type)` Sets the split type attribute. |

## Public constructors

### Builder

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

```
public Builder()
```

## Public methods

### build

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

```
public final @NonNull SplitAttributes build()
```

Builds a `SplitAttributes` instance with the attributes specified by `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setSplitType(androidx.window.embedding.SplitAttributes.SplitType)`, `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setLayoutDirection(androidx.window.embedding.SplitAttributes.LayoutDirection)`, and `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder#setAnimationParams(androidx.window.embedding.EmbeddingAnimationParams)`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes` | The new `SplitAttributes` instance. |

### setAnimationParams

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

```
@RequiresWindowSdkExtension(version = 5)
public final @NonNull SplitAttributes.Builder setAnimationParams(@NonNull EmbeddingAnimationParams params)
```

Sets the animation params to use during animation of the split involving this `SplitAttributes` object if the animation requires a background color or non-default transitions.

`https://developer.android.com/reference/androidx/window/embedding/EmbeddingAnimationParams` can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op when setting the `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAnimationParams` on a target device that has lower API level.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAnimationParams params` | the animation params. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | this `Builder`. |

### setDividerAttributes

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

```
@RequiresWindowSdkExtension(version = 6)
public final @NonNull SplitAttributes.Builder setDividerAttributes(@NonNull DividerAttributes dividerAttributes)
```

Sets the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes` for this split.

The default is `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes#NO_DIVIDER()`, which means no divider is requested.

Divider can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op on a target device that has lower API level.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes dividerAttributes` | The divider attributes. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | This `Builder`. |

### setLayoutDirection

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

```
public final @NonNull SplitAttributes.Builder setLayoutDirection(
    @NonNull SplitAttributes.LayoutDirection layoutDirection
)
```

Sets the split layout direction attribute.

The default is based on locale.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.LayoutDirection layoutDirection` | The layout direction attribute. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | This `Builder`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.LayoutDirection` |   |

### setSplitType

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

```
public final @NonNull SplitAttributes.Builder setSplitType(@NonNull SplitAttributes.SplitType type)
```

Sets the split type attribute.

The default is an equal split between primary and secondary containers.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.SplitType type` | The split type attribute. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.Builder` | This `Builder`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.SplitType` |   |