open class PrecomputedTextCompat : Spannable
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
StaticLayout. Since the text layout information will be included in this instance,
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.
The information required for building
|open static PrecomputedTextCompat!||
Create a new
Returns the count of paragraphs.
Returns the paragraph end offset of the text.
Returns the paragraph start offset of the text.
Returns the parameters used to measure this text.
|open static Future<PrecomputedTextCompat!>!||
Helper for PrecomputedText that returns a future to be used with
open static fun create(
@NonNull text: CharSequence,
@NonNull params: PrecomputedTextCompat.Params
Create a new
PrecomputedText which will pre-compute text measurement and glyph positioning information.
This can be expensive, so computing this on a background thread before your text will be presented can save work on the UI thread.Note that any
android.text.NoCopySpanattached to the text won't be passed to the created PrecomputedText.
||CharSequence: the text to be measured|
||PrecomputedTextCompat.Params: parameters that define how text will be precomputed|