Språk

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. When Merge(LineBreakConfig) merges a configuration with an unspecified word style, it keeps the builder's existing word style.

LineBreakConfig override = new LineBreakConfig.Builder()
     .setLineBreakStyle(LineBreakConfig.LINE_BREAK_STYLE_STRICT)
     .build();  // UNSPECIFIED if no setLineBreakWordStyle is called.
LineBreakConfig config = new 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.

For text layout, this value resolves to None when the target SDK is API level 34 or earlier, and to Auto when the target SDK is API level 35 or later.

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 helps text wrap at meaningful word boundaries. If text cannot fit, it may still be broken at a grapheme boundary.

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.

If a locale list contains Korean script, this option uses Phrase. If it contains Japanese script but not Korean script, the line breaker can try phrase-based breaks when its first result has fewer than five lines. It keeps the phrase-based result only if that result also has fewer than five lines. Otherwise, it uses 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 LineBreakConfig.

Applies to