ReplacementSpan
public abstract class ReplacementSpan
extends MetricAffectingSpan
Known Direct Subclasses
|
Known Indirect Subclasses
|
Summary
Public methods |
abstract void |
draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) 将跨度绘制到画布上。 |
abstract int |
getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) 返回跨度的宽度。 |
void |
updateDrawState(TextPaint ds) 此方法什么都不做,因为ReplacementSpans是明确绘制的,而不是影响绘制属性。 |
void |
updateMeasureState(TextPaint p) 此方法不会执行任何操作,因为ReplacementSpans是显式测量的,而不是影响Paint属性。 |
Public constructors
ReplacementSpan
ReplacementSpan ()
Public methods
draw
void draw (Canvas canvas,
CharSequence text,
int start,
int end,
float x,
int top,
int y,
int bottom,
Paint paint)
将跨度绘制到画布上。
Parameters |
canvas |
Canvas : Canvas into which the span should be rendered. |
text |
CharSequence : Current text. |
start |
int : Start character index for span. |
end |
int : End character index for span. |
x |
float : Edge of the replacement closest to the leading margin. |
top |
int : Top of the line. |
y |
int : Baseline. |
bottom |
int : Bottom of the line. |
paint |
Paint : Paint instance. |
getSize
int getSize (Paint paint,
CharSequence text,
int start,
int end,
Paint.FontMetricsInt fm)
返回跨度的宽度。 扩展类可以通过更新Paint.FontMetricsInt
属性来设置跨度的高度。 如果跨度覆盖整个文本,并且未设置高度,则不会为跨度调用draw(Canvas, CharSequence, int, int, float, int, int, int, Paint)
。
Parameters |
paint |
Paint : Paint instance. |
text |
CharSequence : Current text. |
start |
int : Start character index for span. |
end |
int : End character index for span. |
fm |
Paint.FontMetricsInt : Font metrics, can be null. |
Returns |
int |
Width of the span. |
updateDrawState
void updateDrawState (TextPaint ds)
此方法什么都不做,因为ReplacementSpans是明确绘制的,而不是影响绘制属性。
updateMeasureState
void updateMeasureState (TextPaint p)
此方法不会执行任何操作,因为ReplacementSpans是显式测量的,而不是影响Paint属性。