LayoutElementBuilders.Spacer.Builder


public final class LayoutElementBuilders.Spacer.Builder


Builder for Spacer.

Summary

Public constructors

Creates an instance of Builder.

Public methods

@NonNull LayoutElementBuilders.Spacer

Builds an instance with values accumulated in this Builder.

@NonNull LayoutElementBuilders.Spacer.Builder

Sets the height of this spacer.

@NonNull LayoutElementBuilders.Spacer.Builder

Sets the bounding constraints for the layout affected by the dynamic value from setHeight.

@NonNull LayoutElementBuilders.Spacer.Builder

Sets the bounding constraints for the layout affected by the dynamic value from setWidth.

@NonNull LayoutElementBuilders.Spacer.Builder

Sets androidx.wear.protolayout.ModifiersBuilders.Modifiers for this element.

@NonNull LayoutElementBuilders.Spacer.Builder

Sets the width of this Spacer.

Public constructors

Builder

Added in 1.0.0
public Builder()

Creates an instance of Builder.

Public methods

build

Added in 1.0.0
public @NonNull LayoutElementBuilders.Spacer build()

Builds an instance with values accumulated in this Builder.

setHeight

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setHeight(@NonNull DimensionBuilders.SpacerDimension height)

Sets the height of this spacer. If not defined, defaults to 0.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

When using a dynamic value, make sure to specify the bounding constraints for the affected layout element through setLayoutConstraintsForDynamicWidth(HorizontalLayoutConstraint) otherwise build() fails.

setLayoutConstraintsForDynamicHeight

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
public @NonNull LayoutElementBuilders.Spacer.Builder setLayoutConstraintsForDynamicHeight(
    @NonNull DimensionBuilders.VerticalLayoutConstraint verticalLayoutConstraint
)

Sets the bounding constraints for the layout affected by the dynamic value from setHeight. If the SpacerDimension does not have a dynamic value, this will be ignored.

setLayoutConstraintsForDynamicWidth

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
public @NonNull LayoutElementBuilders.Spacer.Builder setLayoutConstraintsForDynamicWidth(
    @NonNull DimensionBuilders.HorizontalLayoutConstraint horizontalLayoutConstraint
)

Sets the bounding constraints for the layout affected by the dynamic value from setWidth. If the SpacerDimension does not have a dynamic value, this will be ignored.

setWidth

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setWidth(@NonNull DimensionBuilders.SpacerDimension width)

Sets the width of this Spacer. When this is added as the direct child of an Arc, this must be specified as an angular dimension, otherwise a linear dimension must be used. If not defined, defaults to 0.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

When using a dynamic value, make sure to specify the bounding constraints for the affected layout element through setLayoutConstraintsForDynamicWidth(HorizontalLayoutConstraint) otherwise build() fails.