diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/text/StaticLayout.java | 14 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 29 |
2 files changed, 39 insertions, 4 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 6dad23815bef..cc2869f28bbb 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -313,10 +313,17 @@ public class StaticLayout extends Layout { /** * Set break strategy, useful for selecting high quality or balanced paragraph * layout options. The default is {@link Layout#BREAK_STRATEGY_SIMPLE}. + * <p/> + * Enabling hyphenation with either using {@link Layout#HYPHENATION_FREQUENCY_NORMAL} or + * {@link Layout#HYPHENATION_FREQUENCY_FULL} while line breaking is set to one of + * {@link Layout#BREAK_STRATEGY_BALANCED}, {@link Layout#BREAK_STRATEGY_HIGH_QUALITY} + * improves the structure of text layout however has performance impact and requires more + * time to do the text layout. * * @param breakStrategy break strategy for paragraph layout * @return this builder, useful for chaining * @see android.widget.TextView#setBreakStrategy + * @see #setHyphenationFrequency(int) */ @NonNull public Builder setBreakStrategy(@BreakStrategy int breakStrategy) { @@ -329,10 +336,17 @@ public class StaticLayout extends Layout { * possible values are defined in {@link Layout}, by constants named with the pattern * {@code HYPHENATION_FREQUENCY_*}. The default is * {@link Layout#HYPHENATION_FREQUENCY_NONE}. + * <p/> + * Enabling hyphenation with either using {@link Layout#HYPHENATION_FREQUENCY_NORMAL} or + * {@link Layout#HYPHENATION_FREQUENCY_FULL} while line breaking is set to one of + * {@link Layout#BREAK_STRATEGY_BALANCED}, {@link Layout#BREAK_STRATEGY_HIGH_QUALITY} + * improves the structure of text layout however has performance impact and requires more + * time to do the text layout. * * @param hyphenationFrequency hyphenation frequency for the paragraph * @return this builder, useful for chaining * @see android.widget.TextView#setHyphenationFrequency + * @see #setBreakStrategy(int) */ @NonNull public Builder setHyphenationFrequency(@HyphenationFrequency int hyphenationFrequency) { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index ea546969ae4d..5cadbe46163a 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4106,9 +4106,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * TextView is {@link Layout#BREAK_STRATEGY_HIGH_QUALITY}, and the default value for * EditText is {@link Layout#BREAK_STRATEGY_SIMPLE}, the latter to avoid the * text "dancing" when being edited. + * <p/> + * Enabling hyphenation with either using {@link Layout#HYPHENATION_FREQUENCY_NORMAL} or + * {@link Layout#HYPHENATION_FREQUENCY_FULL} while line breaking is set to one of + * {@link Layout#BREAK_STRATEGY_BALANCED}, {@link Layout#BREAK_STRATEGY_HIGH_QUALITY} + * improves the structure of text layout however has performance impact and requires more time + * to do the text layout. * * @attr ref android.R.styleable#TextView_breakStrategy * @see #getBreakStrategy() + * @see #setHyphenationFrequency(int) */ public void setBreakStrategy(@Layout.BreakStrategy int breakStrategy) { mBreakStrategy = breakStrategy; @@ -4134,12 +4141,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * Sets the frequency of automatic hyphenation to use when determining word breaks. * The default value for both TextView and {@link EditText} is - * {@link Layout#HYPHENATION_FREQUENCY_NORMAL}. - * Note that the default hyphenation frequency value is set from the theme. - * - * @param hyphenationFrequency The hyphenation frequency to use. + * {@link Layout#HYPHENATION_FREQUENCY_NONE}. Note that the default hyphenation frequency value + * is set from the theme. + * <p/> + * Enabling hyphenation with either using {@link Layout#HYPHENATION_FREQUENCY_NORMAL} or + * {@link Layout#HYPHENATION_FREQUENCY_FULL} while line breaking is set to one of + * {@link Layout#BREAK_STRATEGY_BALANCED}, {@link Layout#BREAK_STRATEGY_HIGH_QUALITY} + * improves the structure of text layout however has performance impact and requires more time + * to do the text layout. + * <p/> + * Note: Before Android Q, in the theme hyphenation frequency is set to + * {@link Layout#HYPHENATION_FREQUENCY_NORMAL}. The default value is changed into + * {@link Layout#HYPHENATION_FREQUENCY_NONE} on Q. + * + * @param hyphenationFrequency the hyphenation frequency to use, one of + * {@link Layout#HYPHENATION_FREQUENCY_NONE}, + * {@link Layout#HYPHENATION_FREQUENCY_NORMAL}, + * {@link Layout#HYPHENATION_FREQUENCY_FULL} * @attr ref android.R.styleable#TextView_hyphenationFrequency * @see #getHyphenationFrequency() + * @see #getBreakStrategy() */ public void setHyphenationFrequency(@Layout.HyphenationFrequency int hyphenationFrequency) { mHyphenationFrequency = hyphenationFrequency; |
