Język

LineBreakStyle Enum

Definition

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

public enum LineBreakStyle
type LineBreakStyle = 
Inheritance
LineBreakStyle

Fields

Name Value Description
Unspecified -1

No line break style is specified.

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

val override = LineBreakConfig.Builder()
     .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
     .build();  // UNSPECIFIED if no setLineBreakStyle is called.
val config = LineBreakConfig.Builder()
     .setLineBreakStyle(LineBreakConfig.LINE_BREAK_STYLE_STRICT)
     .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_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_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_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 rules are used for line breaking.

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_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.

Loose 1

The least restrictive line-break rules are used for line breaking. This setting is typically used for short lines.

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

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.

Normal 2

The most common line-break rules are used for line breaking.

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

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.

Strict 3

The most strict line-break rules are used for line breaking.

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

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.

NoBreak 4

The line break style that used for preventing automatic line breaking. This is useful when you want to preserve some words in the same line by using LineBreakConfigSpan or LineBreakConfigSpan.createNoBreakSpan() as a shorthand. Note that even if this style is specified, the grapheme based line break is still performed for preventing clipping text.

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

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 5

A special value for the line breaking style option.

The auto option for the line break style set the line break style based on the locale of the text rendering context. You can specify the context locale by android.widget.TextView.setTextLocales(LocaleList) or android.graphics.Paint.setTextLocales(LocaleList).

In the API Build.VERSION_CODES.VANILLA_ICE_CREAM, auto option does followings: - If at least one locale in the locale list contains Japanese script, this option is equivalent to LINE_BREAK_STYLE_STRICT. - Otherwise, this option is equivalent to LINE_BREAK_STYLE_NONE.

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

Android reference for android.graphics.text.LineBreakConfig.LINE_BREAK_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

Unspecified leaves an existing style unchanged during a merge. Auto is an explicit choice that lets the platform select rules from the text's locale. These values have different merge behavior.

NoBreak suppresses normal automatic breaks, but grapheme-based breaks can still occur to prevent clipping.

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

Applies to