Language

LineBreakWordStyle Enum

Definition

Specifies the word-based line-break rules used by a line-break configuration.

public enum LineBreakWordStyle
type LineBreakWordStyle = 
Inheritance
LineBreakWordStyle

Fields

Name Value Description
Unspecified -1

No line break word style is specified. This is a special value of line break word style indicating no style value is specified. When overriding a LineBreakConfig with another LineBreakConfig with Builder.merge(LineBreakConfig) function, the line break word style of overridden config will be kept if the line break word style of overriding config is LINE_BREAK_WORD_STYLE_UNSPECIFIED.

val override = LineBreakConfig.Builder()
     .setLineBreakStyle(LineBreakConfig.LINE_BREAK_STYLE_STRICT)
     .build();  // UNSPECIFIED if no setLineBreakWordStyle is called.
val config = LineBreakConfig.Builder()
     .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
     .merge(override)
     .build()
// Here, config has LINE_BREAK_STYLE_STRICT for line break config and
// LINE_BREAK_WORD_STYLE_PHRASE for line break word style.

This value is resolved to LINE_BREAK_WORD_STYLE_NONE if the target SDK version is API Build.VERSION_CODES.UPSIDE_DOWN_CAKE or before and this value is used for text layout/rendering. This value is resolved to LINE_BREAK_WORD_STYLE_AUTO if the target SDK version is API Build.VERSION_CODES.VANILLA_ICE_CREAM or after and this value is used for text layout/rendering.

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_WORD_STYLE_UNSPECIFIED.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

None 0

No line-break word style is used for line breaking.

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_WORD_STYLE_NONE.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Phrase 1

Line breaking is based on phrases, which results in text wrapping only on meaningful words.

Support for this line-break word style depends on locale. If the current locale does not support phrase-based text wrapping, this setting has no effect.

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Auto 2

A special value for the line breaking word style option.

The auto option for the line break word style does some heuristics based on locales and line count.

In the API Build.VERSION_CODES.VANILLA_ICE_CREAM, auto option does followings: - If at least one locale in the locale list contains Korean script, this option is equivalent to LINE_BREAK_WORD_STYLE_PHRASE. - If not, then if at least one locale in the locale list contains Japanese script, this option is equivalent to LINE_BREAK_WORD_STYLE_PHRASE if the result of its line count is less than 5 lines. - Otherwise, this option is equivalent to LINE_BREAK_WORD_STYLE_NONE.

Note: future versions may have special line breaking word style rules for other locales.

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_WORD_STYLE_AUTO.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Remarks

Phrase requests phrase-based wrapping where the locale supports it. Auto lets the platform use locale and line-count rules; it does not guarantee phrase-based wrapping.

Unspecified preserves the existing value during a merge. It is not the same as explicitly selecting Auto.

This enum exposes the LINE_BREAK_WORD_STYLE_* constants from Android 16 LineBreakConfig.

Applies to