public class ReplacementDrawableSpan extends ReplacementSpan
Modifier and Type | Field and Description |
---|---|
protected Drawable |
mDrawable |
protected static Paint |
sWorkPaint |
Constructor and Description |
---|
ReplacementDrawableSpan(Drawable drawable) |
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas canvas,
CharSequence charSequence,
int start,
int end,
float x,
int top,
int y,
int bottom,
Paint paint)
Draws the span into the canvas.
|
protected Rect |
getBounds() |
int |
getSize(Paint paint,
CharSequence text,
int i,
int i2,
Paint.FontMetricsInt fm)
Returns the width of the span.
|
void |
setExtraMargin(float margin) |
updateDrawState, updateMeasureState
getUnderlying
wrap
protected static final Paint sWorkPaint
protected Drawable mDrawable
public ReplacementDrawableSpan(Drawable drawable)
public void setExtraMargin(float margin)
public int getSize(Paint paint, CharSequence text, int i, int i2, Paint.FontMetricsInt fm)
ReplacementSpan
Paint.FontMetricsInt
. If the span covers the whole
text, and the height is not set,
ReplacementSpan.draw(Canvas, CharSequence, int, int, float, int, int, int, Paint)
will not be
called for the span.getSize
in class ReplacementSpan
paint
- Paint instance.text
- Current text.i
- Start character index for span.i2
- End character index for span.fm
- Font metrics, can be null.public void draw(Canvas canvas, CharSequence charSequence, int start, int end, float x, int top, int y, int bottom, Paint paint)
ReplacementSpan
draw
in class ReplacementSpan
canvas
- Canvas into which the span should be rendered.charSequence
- 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.protected Rect getBounds()