Stay organized with collections
Save and categorize content based on your preferences.
LineHeightSpan
interface LineHeightSpan : ParagraphStyle, WrapTogetherSpan
The classes that affect the line height of paragraph should implement this interface.
Summary
Nested classes |
open |
Default implementation of the LineHeightSpan , which changes the line height of the attached paragraph.
|
abstract |
The classes that affect the line height of paragraph with respect to density, should implement this interface.
|
Public methods |
abstract Unit |
Classes that implement this should define how the height is being calculated.
|
Public methods
chooseHeight
abstract fun chooseHeight(
text: CharSequence!,
start: Int,
end: Int,
spanstartv: Int,
lineHeight: Int,
fm: Paint.FontMetricsInt!
): Unit
Classes that implement this should define how the height is being calculated.
Parameters |
text |
CharSequence!: the text |
start |
Int: the start of the line |
end |
Int: the end of the line |
spanstartv |
Int: the start of the span |
lineHeight |
Int: the line height |
fm |
Paint.FontMetricsInt!: font metrics of the paint, in integers |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# LineHeightSpan\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nLineHeightSpan\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/style/LineHeightSpan \"View this page in Java\") \n\n```\ninterface LineHeightSpan : ParagraphStyle, WrapTogetherSpan\n```\n\n|----------------------------------------|\n| [android.text.style.LineHeightSpan](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [DrawableMarginSpan](/reference/kotlin/android/text/style/DrawableMarginSpan), [IconMarginSpan](/reference/kotlin/android/text/style/IconMarginSpan), [LineHeightSpan.Standard](/reference/kotlin/android/text/style/LineHeightSpan.Standard), [LineHeightSpan.WithDensity](/reference/kotlin/android/text/style/LineHeightSpan.WithDensity) |-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------| | [DrawableMarginSpan](/reference/kotlin/android/text/style/DrawableMarginSpan) | A span which adds a drawable and a padding to the paragraph it's attached to. | | [IconMarginSpan](/reference/kotlin/android/text/style/IconMarginSpan) | Paragraph affecting span, that draws a bitmap at the beginning of a text. | | [LineHeightSpan.Standard](/reference/kotlin/android/text/style/LineHeightSpan.Standard) | Default implementation of the [LineHeightSpan](#), which changes the line height of the attached paragraph. | | [LineHeightSpan.WithDensity](/reference/kotlin/android/text/style/LineHeightSpan.WithDensity) | The classes that affect the line height of paragraph with respect to density, should implement this interface. | |\n\nThe classes that affect the line height of paragraph should implement this interface.\n\nSummary\n-------\n\n| Nested classes ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open | [Standard](/reference/kotlin/android/text/style/LineHeightSpan.Standard) Default implementation of the [LineHeightSpan](#), which changes the line height of the attached paragraph. |\n| abstract | [WithDensity](/reference/kotlin/android/text/style/LineHeightSpan.WithDensity) The classes that affect the line height of paragraph with respect to density, should implement this interface. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [chooseHeight](#chooseHeight(kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20android.graphics.Paint.FontMetricsInt))`(`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)`, `spanstartv:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `lineHeight:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fm:` `[Paint.FontMetricsInt](../../graphics/Paint.FontMetricsInt.html#)!`)` Classes that implement this should define how the height is being calculated. |\n\nPublic methods\n--------------\n\n### chooseHeight\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun chooseHeight(\n text: CharSequence!, \n start: Int, \n end: Int, \n spanstartv: Int, \n lineHeight: Int, \n fm: Paint.FontMetricsInt!\n): Unit\n```\n\nClasses that implement this should define how the height is being calculated.\n\n| Parameters ||\n|--------------|------------------------------------------------------------------------------------------------------------|\n| `text` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: the text |\n| `start` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the start of the line |\n| `end` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the end of the line |\n| `spanstartv` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the start of the span |\n| `lineHeight` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the line height |\n| `fm` | [Paint.FontMetricsInt](../../graphics/Paint.FontMetricsInt.html#)!: font metrics of the paint, in integers |"]]