Stay organized with collections
Save and categorize content based on your preferences.
WithDensity
interface WithDensity : LineHeightSpan
The classes that affect the line height of paragraph with respect to density, should implement this interface.
Summary
Public methods |
abstract Unit |
Classes that implement this should define how the height is being calculated.
|
Public methods
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.WithDensity\n\nAdded in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWithDensity\n===========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/style/LineHeightSpan.WithDensity \"View this page in Java\") \n\n```\ninterface WithDensity : LineHeightSpan\n```\n\n|----------------------------------------------------|\n| [android.text.style.LineHeightSpan.WithDensity](#) |\n\nThe classes that affect the line height of paragraph with respect to density, should implement this interface.\n\nSummary\n-------\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,%20android.text.TextPaint))`(`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#)!`, `paint:` `[TextPaint](../TextPaint.html#)!`)` Classes that implement this should define how the height is being calculated. |\n\n| Inherited functions ||\n|---|---|\n| From class [LineHeightSpan](/reference/kotlin/android/text/style/LineHeightSpan) |------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [chooseHeight](/reference/kotlin/android/text/style/LineHeightSpan#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. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### chooseHeight\n\nAdded in [API level 5](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 paint: TextPaint!\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| `paint` | [TextPaint](../TextPaint.html#)!: the paint |"]]