StaticLayoutFactory

@InternalPlatformTextApi
object StaticLayoutFactory


Summary

Public functions

StaticLayout
create(
    text: CharSequence,
    paint: TextPaint,
    width: Int,
    start: Int,
    end: Int,
    textDir: TextDirectionHeuristic,
    alignment: Layout.Alignment,
    maxLines: @IntRange(from = 0) Int,
    ellipsize: TextUtils.TruncateAt?,
    ellipsizedWidth: @IntRange(from = 0) Int,
    lineSpacingMultiplier: @FloatRange(from = 0.0) Float,
    lineSpacingExtra: Float,
    justificationMode: Int,
    includePadding: Boolean,
    useFallbackLineSpacing: Boolean,
    breakStrategy: Int,
    lineBreakStyle: Int,
    lineBreakWordStyle: Int,
    hyphenationFrequency: Int,
    leftIndents: IntArray?,
    rightIndents: IntArray?
)

Builder class for StaticLayout.

Boolean
isFallbackLineSpacingEnabled(
    layout: StaticLayout,
    useFallbackLineSpacing: Boolean
)

Returns whether fallbackLineSpacing is enabled for the given layout.

Public functions

create

Added in 1.6.0
fun create(
    text: CharSequence,
    paint: TextPaint,
    width: Int,
    start: Int = 0,
    end: Int = text.length,
    textDir: TextDirectionHeuristic = LayoutCompat.DEFAULT_TEXT_DIRECTION_HEURISTIC,
    alignment: Layout.Alignment = LayoutCompat.DEFAULT_LAYOUT_ALIGNMENT,
    maxLines: @IntRange(from = 0) Int = LayoutCompat.DEFAULT_MAX_LINES,
    ellipsize: TextUtils.TruncateAt? = null,
    ellipsizedWidth: @IntRange(from = 0) Int = width,
    lineSpacingMultiplier: @FloatRange(from = 0.0) Float = LayoutCompat.DEFAULT_LINESPACING_MULTIPLIER,
    lineSpacingExtra: Float = LayoutCompat.DEFAULT_LINESPACING_EXTRA,
    justificationMode: Int = LayoutCompat.DEFAULT_JUSTIFICATION_MODE,
    includePadding: Boolean = LayoutCompat.DEFAULT_INCLUDE_PADDING,
    useFallbackLineSpacing: Boolean = LayoutCompat.DEFAULT_FALLBACK_LINE_SPACING,
    breakStrategy: Int = LayoutCompat.DEFAULT_BREAK_STRATEGY,
    lineBreakStyle: Int = LayoutCompat.DEFAULT_LINE_BREAK_STYLE,
    lineBreakWordStyle: Int = LayoutCompat.DEFAULT_LINE_BREAK_WORD_STYLE,
    hyphenationFrequency: Int = LayoutCompat.DEFAULT_HYPHENATION_FREQUENCY,
    leftIndents: IntArray? = null,
    rightIndents: IntArray? = null
): StaticLayout

Builder class for StaticLayout.

isFallbackLineSpacingEnabled

Added in 1.6.0
fun isFallbackLineSpacingEnabled(
    layout: StaticLayout,
    useFallbackLineSpacing: Boolean
): Boolean

Returns whether fallbackLineSpacing is enabled for the given layout.

Parameters
layout: StaticLayout

StaticLayout instance

useFallbackLineSpacing: Boolean

fallbackLineSpacing configuration passed while creating the StaticLayout.