public class Styled
extends java.lang.Object
Spanned object with
ReplacementSpan.| Constructor and Description |
|---|
Styled() |
| Modifier and Type | Method and Description |
|---|---|
static float |
drawText(android.graphics.Canvas canvas,
java.lang.CharSequence text,
int start,
int end,
int direction,
float x,
int top,
int y,
int bottom,
android.text.TextPaint paint,
android.text.TextPaint workPaint,
boolean needWidth)
Draws a run of text on a single line, with its
origin at (x,y), in the specified Paint.
|
static int |
getTextWidths(android.text.TextPaint paint,
android.text.TextPaint workPaint,
android.text.Spanned text,
int start,
int end,
float[] widths,
android.graphics.Paint.FontMetricsInt fmi)
Returns the advance widths for a uniform left-to-right run of text with
no style changes in the middle of the run.
|
static float |
measureText(android.text.TextPaint paint,
android.text.TextPaint workPaint,
java.lang.CharSequence text,
int start,
int end,
android.graphics.Paint.FontMetricsInt fmi)
Returns the width of a run of left-to-right text on a single line,
considering style information in the text (e.g.
|
public static int getTextWidths(android.text.TextPaint paint,
android.text.TextPaint workPaint,
android.text.Spanned text,
int start,
int end,
float[] widths,
android.graphics.Paint.FontMetricsInt fmi)
paint - the paint, will not be modifiedworkPaint - a paint to modify; on return will reflect the original
paint plus the effect of all spans on the runtext - the textstart - the start of the runend - the limit of the runwidths - array to receive the advance widths of the characters. Must
be at least a large as (end - start).fmi - FontMetrics information; can be nullpublic static float drawText(android.graphics.Canvas canvas,
java.lang.CharSequence text,
int start,
int end,
int direction,
float x,
int top,
int y,
int bottom,
android.text.TextPaint paint,
android.text.TextPaint workPaint,
boolean needWidth)
Spanned, this method correctly
draws the text). See also
Canvas.drawText(CharSequence, int, int, float,
float, Paint) and
Canvas.drawRect(float, float, float, float,
Paint).canvas - The target canvastext - The text to be drawnstart - The index of the first character in text to onDrawend - (end - 1) is the index of the last character in text to onDrawdirection - The direction of the text. This must be
Layout.DIR_LEFT_TO_RIGHT or
Layout.DIR_RIGHT_TO_LEFT.x - The x-coordinate of origin for where to onDraw the texttop - The top side of the rectangle to be drawny - The y-coordinate of origin for where to onDraw the textbottom - The bottom side of the rectangle to be drawnpaint - The main TextPaint object.workPaint - The TextPaint object used for temporal
workspace.needWidth - If true, this method returns the width of drawn textpublic static float measureText(android.text.TextPaint paint,
android.text.TextPaint workPaint,
java.lang.CharSequence text,
int start,
int end,
android.graphics.Paint.FontMetricsInt fmi)
Spanned, this method correctly measures
the width of the text).paint - the main TextPaint object; will not be modifiedworkPaint - the TextPaint object available for modification;
will not necessarily be usedtext - the text to measurestart - the index of the first character to start measuringend - 1 beyond the index of the last character to measurefmi - FontMetrics information; can be null