Stay organized with collections
Save and categorize content based on your preferences.
Highlights
open class Highlights
A class that represents of the highlight of the text.
Summary
Nested classes |
|
A builder for the Highlights.
|
Public methods |
open Paint |
Returns a paint used for the i-th highlight.
|
open IntArray |
Returns ranges of the i-th highlight.
|
open Int |
Returns the number of highlight.
|
Public methods
getPaint
open fun getPaint(index: Int): Paint
Returns a paint used for the i-th highlight.
Parameters |
index |
Int: an index of the highlight. Must be between 0 and getSize() |
Return |
Paint |
the paint object |
getRanges
open fun getRanges(index: Int): IntArray
Returns ranges of the i-th highlight. Ranges are represented of flattened inclusive start and exclusive end integers array. The inclusive start offset of the i
-th range is stored in 2 * i
-th of the array. The exclusive end offset of the i
-th range is stored in 2* i + 1
-th of the array. For example, the two ranges: (1, 2) and (3, 4) are flattened into single int array [1, 2, 3, 4].
Parameters |
index |
Int: an index of the highlight. Must be between 0 and getSize() |
getSize
open fun getSize(): Int
Returns the number of highlight.
Return |
Int |
the number of highlight. |
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,["# Highlights\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nHighlights\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/Highlights \"View this page in Java\") \n\n```\nopen class Highlights\n```\n\n|---|------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.text.Highlights](#) |\n\nA class that represents of the highlight of the text.\n\nSummary\n-------\n\n| Nested classes ||\n|---|--------------------------------------------------------------------------------------------|\n| | [Builder](/reference/kotlin/android/text/Highlights.Builder) A builder for the Highlights. |\n\n| Public methods ||\n|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Paint](../graphics/Paint.html#) | [getPaint](#getPaint(kotlin.Int))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns a paint used for the i-th highlight. |\n| open [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html) | [getRanges](#getRanges(kotlin.Int))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns ranges of the i-th highlight. |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSize](#getSize())`()` Returns the number of highlight. |\n\nPublic methods\n--------------\n\n### getPaint\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getPaint(index: Int): Paint\n```\n\nReturns a paint used for the i-th highlight.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `index` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): an index of the highlight. Must be between 0 and [getSize()](#getSize()) |\n\n| Return ||\n|----------------------------------|------------------|\n| [Paint](../graphics/Paint.html#) | the paint object |\n\n**See Also**\n\n- [android.text.Highlights.Builder#addRange(Paint, int, int)](/reference/kotlin/android/text/Highlights.Builder#addRange(android.graphics.Paint,%20kotlin.Int,%20kotlin.Int))\n- [android.text.Highlights.Builder#addRanges(Paint, int...)](/reference/kotlin/android/text/Highlights.Builder#addRanges(android.graphics.Paint,%20kotlin.Int)) \n\n### getRanges\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getRanges(index: Int): IntArray\n```\n\nReturns ranges of the i-th highlight. Ranges are represented of flattened inclusive start and exclusive end integers array. The inclusive start offset of the `i`-th range is stored in `2 * i`-th of the array. The exclusive end offset of the `i`-th range is stored in `2* i + 1`-th of the array. For example, the two ranges: (1, 2) and (3, 4) are flattened into single int array \\[1, 2, 3, 4\\].\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `index` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): an index of the highlight. Must be between 0 and [getSize()](#getSize()) |\n\n| Return ||\n|---------------------------------------------------------------------------------------|-----------------------|\n| [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html) | the flattened ranges. |\n\n**See Also**\n\n- [android.text.Highlights.Builder#addRange(Paint, int, int)](/reference/kotlin/android/text/Highlights.Builder#addRange(android.graphics.Paint,%20kotlin.Int,%20kotlin.Int))\n- [android.text.Highlights.Builder#addRanges(Paint, int...)](/reference/kotlin/android/text/Highlights.Builder#addRanges(android.graphics.Paint,%20kotlin.Int)) \n\n### getSize\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getSize(): Int\n```\n\nReturns the number of highlight.\n\n| Return ||\n|----------------------------------------------------------------------------|--------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the number of highlight. |\n\n**See Also**\n\n- [android.text.Highlights.Builder#addRange(Paint, int, int)](/reference/kotlin/android/text/Highlights.Builder#addRange(android.graphics.Paint,%20kotlin.Int,%20kotlin.Int))\n- [android.text.Highlights.Builder#addRanges(Paint, int...)](/reference/kotlin/android/text/Highlights.Builder#addRanges(android.graphics.Paint,%20kotlin.Int))"]]