PrecomputedTextCompat

A text which has the character metrics data. A text object that contains the character metrics data and can be used to improve the performance of text layout operations. When a PrecomputedTextCompat is created with a given CharSequence, it will measure the text metrics during the creation. This PrecomputedText instance can be set on android.widget.TextView or StaticLayout. Since the text layout information will be included in this instance, android.widget.TextView or StaticLayout will not have to recalculate this information. On API 29 or later, there is full PrecomputedText support by framework. From API 21 to API 27, PrecomputedTextCompat relies on internal text layout cache. PrecomputedTextCompat immediately computes the text layout in the constuctor to warm up the internal text layout cache. On API 20 or before, PrecomputedTextCompat does nothing. Note that any android.text.NoCopySpan attached to the original text won't be passed to PrecomputedText.

Types

Link copied to clipboard
class Params
The information required for building PrecomputedTextCompat.

Functions

Link copied to clipboard
open fun charAt(index: Int): Char
Link copied to clipboard
Create a new PrecomputedText which will pre-compute text measurement and glyph positioning information.
Link copied to clipboard
@IntRange(from = 0)
open fun getParagraphCount(): Int
Returns the count of paragraphs.
Link copied to clipboard
@IntRange(from = 0)
open fun getParagraphEnd(@IntRange(from = 0) paraIndex: Int): Int
Returns the paragraph end offset of the text.
Link copied to clipboard
@IntRange(from = 0)
open fun getParagraphStart(@IntRange(from = 0) paraIndex: Int): Int
Returns the paragraph start offset of the text.
Link copied to clipboard
Returns the parameters used to measure this text.
Link copied to clipboard
Returns the underlying original text if the text is PrecomputedText.
Link copied to clipboard
open fun getSpanEnd(tag: Any): Int
Link copied to clipboard
open fun getSpanFlags(tag: Any): Int
Link copied to clipboard
open fun <T> getSpans(start: Int, end: Int, type: Class<T>): Array<T>
Link copied to clipboard
open fun getSpanStart(tag: Any): Int
Link copied to clipboard
Helper for PrecomputedText that returns a future to be used with setTextFuture.
Link copied to clipboard
open fun length(): Int
Link copied to clipboard
open fun nextSpanTransition(start: Int, limit: Int, type: Class): Int
Link copied to clipboard
open fun removeSpan(what: Any)
Link copied to clipboard
open fun setSpan(what: Any, start: Int, end: Int, flags: Int)
Link copied to clipboard
open fun subSequence(start: Int, end: Int): CharSequence
Link copied to clipboard
open fun toString(): String