DimensionBuilders


public final class DimensionBuilders


Builders for dimensions for layout elements.

Summary

Nested types

@RequiresSchemaVersion(major = 1, minor = 500)
public interface DimensionBuilders.AngularDimension

Interface defining the length of an arc element.

@RequiresSchemaVersion(major = 1, minor = 200)
public final class DimensionBuilders.AngularLayoutConstraint

A type for specifying layout constraints when using DegreesProp on a data bindable layout element.

Builder for AngularLayoutConstraint.

@RequiresSchemaVersion(major = 1, minor = 400)
public final class DimensionBuilders.BoundingBoxRatio implements DimensionBuilders.PivotDimension

Provide a position representation proportional to the bounding box width/height.

Builder for BoundingBoxRatio.

@RequiresSchemaVersion(major = 1, minor = 0)
public interface DimensionBuilders.ContainerDimension

Interface defining a dimension that can be applied to a container.

@RequiresSchemaVersion(major = 1, minor = 0)
public final class DimensionBuilders.DegreesProp implements DimensionBuilders.AngularDimension

A type for angular dimensions, measured in degrees.

Builder for DegreesProp

A type for linear dimensions, measured in dp.

Builder for DpProp.

@RequiresSchemaVersion(major = 1, minor = 0)
public final class DimensionBuilders.EmProp

A type for font spacing, measured in em.

Builder for EmProp

A type for a dimension that fills all the space it can (i.e. MATCH_PARENT in Android parlance).

Builder for ExpandedDimensionProp.

Interface defining a dimension that can be applied to a element.

@RequiresSchemaVersion(major = 1, minor = 200)
public final class DimensionBuilders.HorizontalLayoutConstraint

A type for specifying horizontal layout constraints when using DpProp on a data bindable layout element.

Builder for HorizontalLayoutConstraint.

@RequiresSchemaVersion(major = 1, minor = 0)
public interface DimensionBuilders.ImageDimension

Interface defining a dimension that can be applied to an image.

@RequiresSchemaVersion(major = 1, minor = 400)
public interface DimensionBuilders.PivotDimension

Interface defining a dimension that can be applied to a pivot location for scale and rotate transformations.

A type for a dimension that scales itself proportionally to another dimension such that the aspect ratio defined by the given width and height values is preserved.

Builder for ProportionalDimensionProp.

@RequiresSchemaVersion(major = 1, minor = 0)
public final class DimensionBuilders.SpProp

A type for font sizes, measured in sp.

Builder for SpProp

@RequiresSchemaVersion(major = 1, minor = 0)
public interface DimensionBuilders.SpacerDimension

Interface defining a dimension that can be applied to a spacer.

@RequiresSchemaVersion(major = 1, minor = 200)
public final class DimensionBuilders.VerticalLayoutConstraint

A type for specifying vertical layout constraints when using DpProp on a data bindable layout element.

Builder for VerticalLayoutConstraint.

A type for a dimension that sizes itself to the size of its children (i.e. WRAP_CONTENT in Android parlance).

Builder for WrappedDimensionProp.

Public methods

static @NonNull DimensionBuilders.DegreesProp
@RequiresSchemaVersion(major = 1, minor = 0)
degrees(float valueDegrees)

Shortcut for building an DegreesProp using a measurement in degrees.

static @NonNull DimensionBuilders.DpProp
@RequiresSchemaVersion(major = 1, minor = 0)
dp(@Dimension(unit = 0) float valueDp)

Shortcut for building a DpProp using a measurement in DP.

static @NonNull DimensionBuilders.EmProp
@RequiresSchemaVersion(major = 1, minor = 0)
em(float valueEm)

Shortcut for building a EmProp using a measurement in EM.

static @NonNull DimensionBuilders.EmProp
@RequiresSchemaVersion(major = 1, minor = 0)
em(int valueEm)

Shortcut for building a EmProp using a measurement in EM.

static @NonNull DimensionBuilders.ExpandedDimensionProp
@RequiresSchemaVersion(major = 1, minor = 0)
expand()

Shortcut for building an ExpandedDimensionProp that will expand to the size of its parent.

static @NonNull DimensionBuilders.SpProp
@RequiresSchemaVersion(major = 1, minor = 0)
sp(@Dimension(unit = 2) float valueSp)

Shortcut for building a SpProp using a measurement in SP.

static @NonNull DimensionBuilders.ExpandedDimensionProp
@RequiresSchemaVersion(major = 1, minor = 300)
weight(@FloatRange(from = 0.0) float weight)

Shortcut for building an ExpandedDimensionProp with weight (a dimensionless scalar value).

static @NonNull DimensionBuilders.WrappedDimensionProp
@RequiresSchemaVersion(major = 1, minor = 0)
wrap()

Shortcut for building an WrappedDimensionProp that will shrink to the size of its children.

Public methods

degrees

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.DegreesProp degrees(float valueDegrees)

Shortcut for building an DegreesProp using a measurement in degrees.

dp

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.DpProp dp(@Dimension(unit = 0) float valueDp)

Shortcut for building a DpProp using a measurement in DP.

em

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.EmProp em(float valueEm)

Shortcut for building a EmProp using a measurement in EM.

em

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.EmProp em(int valueEm)

Shortcut for building a EmProp using a measurement in EM.

expand

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.ExpandedDimensionProp expand()

Shortcut for building an ExpandedDimensionProp that will expand to the size of its parent.

sp

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.SpProp sp(@Dimension(unit = 2) float valueSp)

Shortcut for building a SpProp using a measurement in SP.

weight

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
public static @NonNull DimensionBuilders.ExpandedDimensionProp weight(@FloatRange(from = 0.0) float weight)

Shortcut for building an ExpandedDimensionProp with weight (a dimensionless scalar value).

This will only affect the width of children of a or the height of children of a , otherwise it will expand to the size of its parent. Where applicable, the remaining space in the width or height left from the children with fixed or wrapped dimension will be proportionally split across children with expand dimension, meaning that the width or height of the element is proportional to the sum of the weights of its weighted siblings. For the siblings that don't have weight set, but they are expanded, defaults to 1.

wrap

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull DimensionBuilders.WrappedDimensionProp wrap()

Shortcut for building an WrappedDimensionProp that will shrink to the size of its children.