Stay organized with collections
Save and categorize content based on your preferences.
LineBackgroundSpan
interface LineBackgroundSpan : ParagraphStyle
Used to change the background of lines where the span is attached to.
Summary
Nested classes |
open |
Default implementation of the LineBackgroundSpan , which changes the background color of the lines to which the span is attached.
|
Public methods |
abstract Unit |
drawBackground(canvas: Canvas, paint: Paint, left: Int, right: Int, top: Int, baseline: Int, bottom: Int, text: CharSequence, start: Int, end: Int, lineNumber: Int)
Draw the background on the canvas.
|
Public methods
drawBackground
abstract fun drawBackground(
canvas: Canvas,
paint: Paint,
left: Int,
right: Int,
top: Int,
baseline: Int,
bottom: Int,
text: CharSequence,
start: Int,
end: Int,
lineNumber: Int
): Unit
Draw the background on the canvas.
Parameters |
canvas |
Canvas: canvas on which the span should be rendered This value cannot be null . |
paint |
Paint: paint used to draw text, which should be left unchanged on exit This value cannot be null . |
left |
Int: left position of the line relative to input canvas, in pixels The units of this value are pixels. |
right |
Int: right position of the line relative to input canvas, in pixels The units of this value are pixels. |
top |
Int: top position of the line relative to input canvas, in pixels The units of this value are pixels. |
baseline |
Int: baseline of the text relative to input canvas, in pixels The units of this value are pixels. |
bottom |
Int: bottom position of the line relative to input canvas, in pixels The units of this value are pixels. |
text |
CharSequence: current text This value cannot be null . |
start |
Int: start character index of the line |
end |
Int: end character index of the line |
lineNumber |
Int: line number in the current text layout |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# LineBackgroundSpan\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nLineBackgroundSpan\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/style/LineBackgroundSpan \"View this page in Java\") \n\n```\ninterface LineBackgroundSpan : ParagraphStyle\n```\n\n|--------------------------------------------|\n| [android.text.style.LineBackgroundSpan](#) |\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [LineBackgroundSpan.Standard](/reference/kotlin/android/text/style/LineBackgroundSpan.Standard) |-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| | [LineBackgroundSpan.Standard](/reference/kotlin/android/text/style/LineBackgroundSpan.Standard) | Default implementation of the [LineBackgroundSpan](#), which changes the background color of the lines to which the span is attached. | |\n\nUsed to change the background of lines where the span is attached to.\n\nSummary\n-------\n\n| Nested classes ||\n|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open | [Standard](/reference/kotlin/android/text/style/LineBackgroundSpan.Standard) Default implementation of the [LineBackgroundSpan](#), which changes the background color of the lines to which the span is attached. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [drawBackground](#drawBackground(android.graphics.Canvas,%20android.graphics.Paint,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`canvas:` `[Canvas](../../graphics/Canvas.html#)`, `paint:` `[Paint](../../graphics/Paint.html#)`, `left:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `right:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `top:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `baseline:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `bottom:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`, `start:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `end:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `lineNumber:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Draw the background on the canvas. |\n\nPublic methods\n--------------\n\n### drawBackground\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun drawBackground(\n canvas: Canvas, \n paint: Paint, \n left: Int, \n right: Int, \n top: Int, \n baseline: Int, \n bottom: Int, \n text: CharSequence, \n start: Int, \n end: Int, \n lineNumber: Int\n): Unit\n```\n\nDraw the background on the canvas.\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `canvas` | [Canvas](../../graphics/Canvas.html#): canvas on which the span should be rendered This value cannot be `null`. |\n| `paint` | [Paint](../../graphics/Paint.html#): paint used to draw text, which should be left unchanged on exit This value cannot be `null`. |\n| `left` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): left position of the line relative to input canvas, in pixels The units of this value are pixels. |\n| `right` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): right position of the line relative to input canvas, in pixels The units of this value are pixels. |\n| `top` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): top position of the line relative to input canvas, in pixels The units of this value are pixels. |\n| `baseline` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): baseline of the text relative to input canvas, in pixels The units of this value are pixels. |\n| `bottom` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): bottom position of the line relative to input canvas, in pixels The units of this value are pixels. |\n| `text` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html): current text This value cannot be `null`. |\n| `start` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): start character index of the line |\n| `end` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): end character index of the line |\n| `lineNumber` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): line number in the current text layout |"]]