# DividerAttributes.DraggableDividerAttributes.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/DividerAttributes.kt+class:androidx.window.embedding.DividerAttributes.DraggableDividerAttributes.Builder) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)

*** ** * ** ***

<br />

```
@RequiresWindowSdkExtension(version = 6)
public final class DividerAttributes.DraggableDividerAttributes.Builder
```

<br />

*** ** * ** ***

The `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes` builder.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#Builder()()` creates a new `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` |
| `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#Builder(androidx.window.embedding.DividerAttributes.DraggableDividerAttributes)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes original)` The `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes` builder constructor initialized by an existing `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes`. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#build()()` Builds a `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes` instance. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#setColor(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/ColorInt int color)` Sets the color of the divider. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#setDragRange(androidx.window.embedding.DividerAttributes.DragRange)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange dragRange)` Sets the drag range of the divider in terms of the split ratio of the primary container. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 7) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#setDraggingToFullscreenAllowed(kotlin.Boolean)(boolean allowed)` Sets whether dragging to full screen is allowed. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` | `@https://developer.android.com/reference/androidx/window/RequiresWindowSdkExtension(version = 6) https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder#setWidthDp(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int widthDp)` Sets the divider width. |

## Public constructors

### Builder

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

```
public Builder()
```

creates a new `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder`

### Builder

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

```
@RequiresWindowSdkExtension(version = 6)
public Builder(@NonNull DividerAttributes.DraggableDividerAttributes original)
```

The `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes` builder constructor initialized by an existing `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes original` | the original `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes` to initialize the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DraggableDividerAttributes.Builder` |

## Public methods

### build

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

```
@RequiresWindowSdkExtension(version = 6)
public final @NonNull DividerAttributes.DraggableDividerAttributes build()
```

Builds a `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes` instance.

### setColor

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

```
@RequiresWindowSdkExtension(version = 6)
public final @NonNull DividerAttributes.DraggableDividerAttributes.Builder setColor(@ColorInt int color)
```

Sets the color of the divider. If not set, the default color `https://developer.android.com/reference/android/graphics/Color.html#BLACK` is used.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the provided value is invalid. |

### setDragRange

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

```
@RequiresWindowSdkExtension(version = 6)
public final @NonNull DividerAttributes.DraggableDividerAttributes.Builder setDragRange(@NonNull DividerAttributes.DragRange dragRange)
```

Sets the drag range of the divider in terms of the split ratio of the primary container. It defaults to `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange#DRAG_RANGE_SYSTEM_DEFAULT()`, which means the system will choose a default value based on the display size and form factor.

When the user drags the divider beyond this range, the system will choose to either fully expand the container or move the divider back into the range.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange dragRange` | the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange` for the draggable divider. |

### setDraggingToFullscreenAllowed

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

```
@RequiresWindowSdkExtension(version = 7)
public final @NonNull DividerAttributes.DraggableDividerAttributes.Builder setDraggingToFullscreenAllowed(boolean allowed)
```

Sets whether dragging to full screen is allowed.

If `true`, the user is allowed to drag beyond the specified range temporarily. When dragging is finished, if the dragging position is below the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange.SplitRatioDragRange#minRatio()` or the default min ratio in `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange#DRAG_RANGE_SYSTEM_DEFAULT()`, the system will choose to either fully expand the secondary container or move the divider back to the range limit; if the dragging position is above the `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange.SplitRatioDragRange#maxRatio()` or the default max ratio in `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes.DragRange#DRAG_RANGE_SYSTEM_DEFAULT()`, the system will choose to either fully expand the primary container or move the divider back to the range limit.

When the primary container is fully expanded, the secondary container is dismissed. When the secondary container is fully expanded, the primary container is hidden behind the secondary container, and the drag handle is displayed on the edge to allow the user to drag and bring back the primary container.

Default to `false`.

This is only supported on devices with Window SDK extensions version 7 and above. For devices with Window SDK extensions below version 7, dragging to fullscreen is always disabled.

### setWidthDp

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

```
@RequiresWindowSdkExtension(version = 6)
public final @NonNull DividerAttributes.DraggableDividerAttributes.Builder setWidthDp(@IntRange(from = -1) int widthDp)
```

Sets the divider width. It defaults to `https://developer.android.com/reference/androidx/window/embedding/DividerAttributes#WIDTH_SYSTEM_DEFAULT()`, which means the system will choose a default value based on the display size and form factor.

When 0dp is used for a draggable divider, the drag handle is rendered without a divider line.

Note: a known compatibility issue causes incorrect rendering of 0-width divider in extensions v7. In this case, the divider width is set to 1dp as a mitigation.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the provided value is invalid. |