ReplacementSpan
abstract class ReplacementSpan : MetricAffectingSpan
kotlin.Any | |||
↳ | android.text.style.CharacterStyle | ||
↳ | android.text.style.MetricAffectingSpan | ||
↳ | android.text.style.ReplacementSpan |
Summary
Public constructors | |
---|---|
Public methods | |
---|---|
abstract Unit |
draw(canvas: Canvas, text: CharSequence!, start: Int, end: Int, x: Float, top: Int, y: Int, bottom: Int, paint: Paint) Draws the span into the canvas. |
open CharSequence? |
Gets a brief description of this ReplacementSpan for use in accessibility support. |
abstract Int |
getSize(paint: Paint, text: CharSequence!, start: Int, end: Int, fm: Paint.FontMetricsInt?) Returns the width of the span. |
open Unit |
setContentDescription(contentDescription: CharSequence?) Sets the specific content description into ReplacementSpan. |
open Unit |
updateDrawState(ds: TextPaint!) This method does nothing, since ReplacementSpans are drawn explicitly instead of affecting Paint properties. |
open Unit |
This method does nothing, since ReplacementSpans are measured explicitly instead of affecting Paint properties. |
Inherited functions | |
---|---|
Public constructors
ReplacementSpan
ReplacementSpan()
Public methods
draw
abstract fun draw(
canvas: Canvas,
text: CharSequence!,
start: Int,
end: Int,
x: Float,
top: Int,
y: Int,
bottom: Int,
paint: Paint
): Unit
Draws the span into the canvas.
Parameters | |
---|---|
canvas |
Canvas: Canvas into which the span should be rendered. This value cannot be null . |
text |
CharSequence!: Current text. |
start |
Int: Start character index for span. Value is 0 or greater |
end |
Int: End character index for span. Value is 0 or greater |
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. This value cannot be null . |
getContentDescription
open fun getContentDescription(): CharSequence?
Gets a brief description of this ReplacementSpan for use in accessibility support.
Return | |
---|---|
CharSequence? |
The content description. This value may be null . |
getSize
abstract fun getSize(
paint: Paint,
text: CharSequence!,
start: Int,
end: Int,
fm: Paint.FontMetricsInt?
): Int
Returns the width of the span. Extending classes can set the height of the span by updating attributes of android.graphics.Paint.FontMetricsInt
. If the span covers the whole text, and the height is not set, draw(android.graphics.Canvas,java.lang.CharSequence,int,int,float,int,int,int,android.graphics.Paint)
will not be called for the span.
Parameters | |
---|---|
paint |
Paint: Paint instance. This value cannot be null . |
text |
CharSequence!: Current text. |
start |
Int: Start character index for span. Value is 0 or greater |
end |
Int: End character index for span. Value is 0 or greater |
fm |
Paint.FontMetricsInt?: Font metrics, can be null. |
Return | |
---|---|
Int |
Width of the span. |
setContentDescription
open fun setContentDescription(contentDescription: CharSequence?): Unit
Sets the specific content description into ReplacementSpan. ReplacementSpans are shared with accessibility services, but only the content description is available from them.
Parameters | |
---|---|
contentDescription |
CharSequence?: content description. The default value is null. |
updateDrawState
open fun updateDrawState(ds: TextPaint!): Unit
This method does nothing, since ReplacementSpans are drawn explicitly instead of affecting Paint properties.
updateMeasureState
open fun updateMeasureState(p: TextPaint): Unit
This method does nothing, since ReplacementSpans are measured explicitly instead of affecting Paint properties.
Parameters | |
---|---|
textPaint |
the paint used for drawing the text This value cannot be null . |