LayoutElementBuilders.Spacer.Builder
public final class LayoutElementBuilders.Spacer.Builder
Builder for Spacer
.
Summary
Public methods
build
public @NonNull LayoutElementBuilders.Spacer build()
Builds an instance with values accumulated in this Builder.
setHeight
@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
@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
@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.
setModifiers
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setModifiers(@NonNull ModifiersBuilders.Modifiers modifiers)
Sets androidx.wear.protolayout.ModifiersBuilders.Modifiers
for this element.
setWidth
@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.