Added in API level 29

Builder

class Builder
kotlin.Any
   ↳ android.graphics.text.LineBreaker.Builder

Helper class for creating a LineBreaker.

Summary

Public constructors

Public methods
LineBreaker

Build a new LineBreaker with given parameters.

LineBreaker.Builder
setBreakStrategy(breakStrategy: Int)

Set break strategy.

LineBreaker.Builder
setHyphenationFrequency(hyphenationFrequency: Int)

Set hyphenation frequency.

LineBreaker.Builder
setIndents(indents: IntArray?)

Set indents.

LineBreaker.Builder
setJustificationMode(justificationMode: Int)

Set whether the text is justified.

Public constructors

Builder

Builder()

Public methods

build

Added in API level 29
fun build(): LineBreaker

Build a new LineBreaker with given parameters. You can reuse the Builder instance even after calling this method.

Return
LineBreaker This value cannot be null.

setBreakStrategy

Added in API level 29
fun setBreakStrategy(breakStrategy: Int): LineBreaker.Builder

Set break strategy. You can change the line breaking behavior by setting break strategy. The default value is BREAK_STRATEGY_SIMPLE.

Parameters
breakStrategy Int: Value is android.graphics.text.LineBreaker#BREAK_STRATEGY_SIMPLE, android.graphics.text.LineBreaker#BREAK_STRATEGY_HIGH_QUALITY, or android.graphics.text.LineBreaker#BREAK_STRATEGY_BALANCED
Return
LineBreaker.Builder This value cannot be null.

setHyphenationFrequency

Added in API level 29
fun setHyphenationFrequency(hyphenationFrequency: Int): LineBreaker.Builder

Set hyphenation frequency. You can change the amount of automatic hyphenation used. The default value is HYPHENATION_FREQUENCY_NONE.

Parameters
hyphenationFrequency Int: Value is android.graphics.text.LineBreaker#HYPHENATION_FREQUENCY_NORMAL, android.graphics.text.LineBreaker#HYPHENATION_FREQUENCY_FULL, or android.graphics.text.LineBreaker#HYPHENATION_FREQUENCY_NONE
Return
LineBreaker.Builder This value cannot be null.

setIndents

Added in API level 29
fun setIndents(indents: IntArray?): LineBreaker.Builder

Set indents. The supplied array provides the total amount of indentation per line, in pixel. This amount is the sum of both left and right indentations. For lines past the last element in the array, the indentation amount of the last element is used.

Parameters
indents IntArray?: This value may be null.
Return
LineBreaker.Builder This value cannot be null.

setJustificationMode

Added in API level 29
fun setJustificationMode(justificationMode: Int): LineBreaker.Builder

Set whether the text is justified. By setting JUSTIFICATION_MODE_INTER_WORD, the line breaker will change the internal parameters for justification. The default value is JUSTIFICATION_MODE_NONE

Parameters
justificationMode Int: Value is android.graphics.text.LineBreaker#JUSTIFICATION_MODE_NONE, or android.graphics.text.LineBreaker#JUSTIFICATION_MODE_INTER_WORD
Return
LineBreaker.Builder This value cannot be null.