LayoutElementBuilders.Spacer


@RequiresSchemaVersion(major = 1, minor = 0)
public final class LayoutElementBuilders.Spacer implements LayoutElementBuilders.LayoutElement


A simple spacer, typically used to provide padding between adjacent elements.

Summary

Nested types

Builder for Spacer.

Public methods

@Nullable DimensionBuilders.SpacerDimension

Gets the height of this spacer.

@Nullable DimensionBuilders.VerticalLayoutConstraint

Gets the bounding constraints for the layout affected by the dynamic value from getHeight.

@Nullable DimensionBuilders.HorizontalLayoutConstraint

Gets the bounding constraints for the layout affected by the dynamic value from getWidth.

@Nullable ModifiersBuilders.Modifiers

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

@Nullable DimensionBuilders.SpacerDimension

Gets the width of this Spacer.

@NonNull String

Public methods

getHeight

Added in 1.0.0
public @Nullable DimensionBuilders.SpacerDimension getHeight()

Gets 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.

getLayoutConstraintsForDynamicHeight

Added in 1.0.0
public @Nullable DimensionBuilders.VerticalLayoutConstraint getLayoutConstraintsForDynamicHeight()

Gets the bounding constraints for the layout affected by the dynamic value from getHeight.

getLayoutConstraintsForDynamicWidth

Added in 1.0.0
public @Nullable DimensionBuilders.HorizontalLayoutConstraint getLayoutConstraintsForDynamicWidth()

Gets the bounding constraints for the layout affected by the dynamic value from getWidth.

getWidth

Added in 1.0.0
public @Nullable DimensionBuilders.SpacerDimension getWidth()

Gets 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.

toString

public @NonNull String toString()

Discover the latest app development tools, platform updates, training, and documentation for developers across every Android device.

Updated May 14, 2024

Jetpack Compose is Android's recommended modern toolkit for building native UI. It simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs.

Updated Dec 11, 2024

The developer center about creating games for Android. Learn how to develop, optimize, and publish your Android game using the latest tools and SDKs.

Updated Nov 13, 2024