public abstract class ReplacementSpan extends MetricAffectingSpan
Constructor and Description |
---|
ReplacementSpan() |
Modifier and Type | Method and Description |
---|---|
abstract void |
draw(Canvas canvas,
CharSequence text,
int start,
int end,
float x,
int top,
int y,
int bottom,
Paint paint)
Draws the span into the canvas.
|
abstract int |
getSize(Paint paint,
CharSequence text,
int start,
int end,
Paint.FontMetricsInt fm)
Returns the width of the span.
|
void |
updateDrawState(TextPaint ds)
This method does nothing, since ReplacementSpans are drawn
explicitly instead of affecting Paint properties.
|
void |
updateMeasureState(TextPaint p)
This method does nothing, since ReplacementSpans are measured
explicitly instead of affecting Paint properties.
|
getUnderlying
wrap
public abstract int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm)
Paint.FontMetricsInt
. If the span covers the whole
text, and the height is not set,
draw(Canvas, CharSequence, int, int, float, int, int, int, Paint)
will not be
called for the span.paint
- Paint instance.text
- Current text.start
- Start character index for span.end
- End character index for span.fm
- Font metrics, can be null.public abstract void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint)
canvas
- Canvas into which the span should be rendered.text
- Current text.start
- Start character index for span.end
- End character index for span.x
- Edge of the replacement closest to the leading margin.top
- Top of the line.y
- Baseline.bottom
- Bottom of the line.paint
- Paint instance.public void updateMeasureState(TextPaint p)
updateMeasureState
in class MetricAffectingSpan
public void updateDrawState(TextPaint ds)
updateDrawState
in class CharacterStyle