diff options
| author | Gilles Debunne <debunne@google.com> | 2011-08-10 18:25:49 -0700 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2011-08-11 13:31:00 -0700 |
| commit | dd8f5ed79c7baed35b3f04e4778aff7867653255 (patch) | |
| tree | 013329e7cf2c0cd9b1359d048deba5b84dba34af /core/java/android/text/TextPaint.java | |
| parent | 27dca78ec1bd7b789226524dcda4fa5a5a2a8544 (diff) | |
Added support for colored / thick underlined text.
Change-Id: Ib0e259dd20546855899bf091f694e41e7051fecb
Diffstat (limited to 'core/java/android/text/TextPaint.java')
| -rw-r--r-- | core/java/android/text/TextPaint.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/java/android/text/TextPaint.java b/core/java/android/text/TextPaint.java index f9e7cac6c505..de57dfabdb5b 100644 --- a/core/java/android/text/TextPaint.java +++ b/core/java/android/text/TextPaint.java @@ -23,11 +23,22 @@ import android.graphics.Paint; * data used during text measuring and drawing. */ public class TextPaint extends Paint { + // Special value 0 means no background paint public int bgColor; public int baselineShift; public int linkColor; public int[] drawableState; public float density = 1.0f; + /** + * Special value 0 means no custom underline + * @hide + */ + public int underlineColor; + /** + * Defined as a multiplier of the default underline thickness. Use 1.0f for default thickness. + * @hide + */ + public float underlineThickness; public TextPaint() { super(); @@ -53,5 +64,24 @@ public class TextPaint extends Paint { linkColor = tp.linkColor; drawableState = tp.drawableState; density = tp.density; + underlineColor = tp.underlineColor; + underlineThickness = tp.underlineThickness; + } + + /** + * Defines a custom underline for this Paint. + * @param color underline solid color + * @param thickness underline thickness, defined as a multiplier of the default underline + * thickness. + * @hide + */ + public void setUnderlineText(boolean isUnderlined, int color, float thickness) { + setUnderlineText(false); + if (isUnderlined) { + underlineColor = color; + underlineThickness = thickness; + } else { + underlineColor = 0; + } } } |
