Added in API level 34

Highlights


open class Highlights
kotlin.Any
   ↳ android.text.Highlights

A class that represents of the highlight of the text.

Summary

Nested classes

A builder for the Highlights.

Public methods
open Paint
getPaint(index: Int)

Returns a paint used for the i-th highlight.

open IntArray
getRanges(index: Int)

Returns ranges of the i-th highlight.

open Int

Returns the number of highlight.

Public methods

getPaint

Added in API level 34
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

Added in API level 34
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()
Return
IntArray the flattened ranges.

getSize

Added in API level 34
open fun getSize(): Int

Returns the number of highlight.

Return
Int the number of highlight.