Serializable, Comparable<TextLayout.LineBreakStrategy>public static enum TextLayout.LineBreakStrategy extends Enum<TextLayout.LineBreakStrategy>
The time required for text layout depends on whether word wrapping is required.
By default, LineBreakStrategy#WORD_WRAP provides better performance.
| 枚举常量 | 说明 |
|---|---|
ADVANCED |
Indicates the advanced line breaking strategy, which complies with the settings of
HyphenationStrategy. |
BALANCED |
Indicates the balanced line breaking strategy, which complies with the settings of
HyphenationStrategy. |
WORD_WRAP |
Indicates the default line breaking strategy, which is simple and fast.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static TextLayout.LineBreakStrategy |
getByInt(int enumInt) |
Obtains the
LineBreakStrategy object based on the specified enumInt. |
int |
getValue() |
Obtains the value of
LineBreakStrategy in this TextLayout. |
static TextLayout.LineBreakStrategy |
valueOf(String name) |
返回带有指定名称的该类型的枚举常量。
字符串必须与用于声明该类型的枚举常量的
标识符完全匹配。(不允许有多余
的空格字符。)
|
static TextLayout.LineBreakStrategy[] |
values() |
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。该方法可用于迭代
常量, 如下所示:
for (TextLayout.LineBreakStrategy c : TextLayout.LineBreakStrategy.values()) System.out.println(c); |
public static final TextLayout.LineBreakStrategy WORD_WRAP
HyphenationStrategy applies only when a line has a single word and
that word is longer than the line width.
This strategy may result in too large blank spaces at the end of a line if long words exist.public static final TextLayout.LineBreakStrategy ADVANCED
HyphenationStrategy.
This strategy tries to break lines in different places so that each line looks relatively full
(except the last line of a paragraph).public static final TextLayout.LineBreakStrategy BALANCED
HyphenationStrategy.
This strategy tries to break lines in different places so that the width of each line looks similar
(including the last line of a paragraph).public static TextLayout.LineBreakStrategy[] values()
for (TextLayout.LineBreakStrategy c : TextLayout.LineBreakStrategy.values()) System.out.println(c);
public static TextLayout.LineBreakStrategy valueOf(String name)
name - 要返回的枚举常量的名称。IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量NullPointerException - 如果参数为空值public int getValue()
LineBreakStrategy in this TextLayout.LineBreakStrategy.public static TextLayout.LineBreakStrategy getByInt(int enumInt)
LineBreakStrategy object based on the specified enumInt.enumInt - Indicates the enumeration value.LineBreakStrategy object of the matched enumInt value.