LayoutString
public final class LayoutString
Static or dynamic string value for layout fields.
This can be used on layout string fields with data binding support.
Summary
Public constructors |
|---|
LayoutString(@NonNull String staticValue)Creates an instance for a static String value. |
@RequiresSchemaVersion(major = 1, minor = 600)Creates an instance for a |
@RequiresSchemaVersion(major = 1, minor = 200)Creates an instance for a |
Public methods |
|
|---|---|
boolean |
|
final DynamicBuilders.DynamicString |
The dynamic value. |
final TypeBuilders.StringLayoutConstraint |
When |
final @NonNull String |
The static value. |
int |
hashCode() |
@NonNull String |
toString() |
Public constructors
LayoutString
public LayoutString(@NonNull String staticValue)
Creates an instance for a static String value.
LayoutString
@RequiresSchemaVersion(major = 1, minor = 600)
public LayoutString(
@NonNull String staticValue,
@NonNull DynamicBuilders.DynamicString dynamicValue
)
Creates an instance for a DynamicString value with a static value fallback. The text element will size itself to the content of the dynamicValue, as no layoutConstraint is specified.
| Parameters | |
|---|---|
@NonNull String staticValue |
the static value that can be used when the |
@NonNull DynamicBuilders.DynamicString dynamicValue |
the dynamic value. If this value can be resolved, the |
LayoutString
@RequiresSchemaVersion(major = 1, minor = 200)
public LayoutString(
@NonNull String staticValue,
@NonNull DynamicBuilders.DynamicString dynamicValue,
@NonNull TypeBuilders.StringLayoutConstraint layoutConstraint
)
Creates an instance for a DynamicString value with a static value fallback and a set of layout constraints for the dynamic value.
| Parameters | |
|---|---|
@NonNull String staticValue |
the static value that can be used when the |
@NonNull DynamicBuilders.DynamicString dynamicValue |
the dynamic value. If this value can be resolved, the |
@NonNull TypeBuilders.StringLayoutConstraint layoutConstraint |
used to correctly measure layout Text element size and align text to ensure that the layout is of a known size during the layout pass regardless of the |
Public methods
getDynamicValue
public final DynamicBuilders.DynamicString getDynamicValue()
The dynamic value. If this can't be resolved staticValue will be used during rendering.
getLayoutConstraint
public final TypeBuilders.StringLayoutConstraint getLayoutConstraint()
When dynamicValue is used, layoutConstraint ensures that the text element has a known fixed size during the layout pass, independently of the actual dynamicValue String. If not set, the text element will size itself to the content of the dynamicValue.
getStaticValue
public final @NonNull String getStaticValue()
The static value. If dynamicValue is not null this will be used as the default value for when dynamicValue can't be resolved.