{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

AnnotatedString.Range

public final class AnnotatedString.Range<T extends Object>


The information attached on the text such as a SpanStyle.

Summary

Public constructors

<T extends Object> Range(@NonNull T item, int start, int end)
<T extends Object> Range(@NonNull T item, int start, int end, @NonNull String tag)

Public methods

final int

The end of the range where item takes effect.

final @NonNull T

The object attached to AnnotatedStrings.

final int

The start of the range where item takes effect.

final @NonNull String

The tag used to distinguish the different ranges.

Public constructors

Range

public <T extends Object> Range(@NonNull T item, int start, int end)

Range

public <T extends Object> Range(@NonNull T item, int start, int end, @NonNull String tag)
Parameters
@NonNull T item

The object attached to AnnotatedStrings.

int start

The start of the range where item takes effect. It's inclusive

int end

The end of the range where item takes effect. It's exclusive

@NonNull String tag

The tag used to distinguish the different ranges. It is useful to store custom data. And Ranges with same tag can be queried with functions such as getStringAnnotations.

Public methods

getEnd

public final int getEnd()

The end of the range where item takes effect. It's exclusive

getItem

public final @NonNullgetItem()

The object attached to AnnotatedStrings.

getStart

public final int getStart()

The start of the range where item takes effect. It's inclusive

getTag

public final @NonNull String getTag()

The tag used to distinguish the different ranges. It is useful to store custom data. And Ranges with same tag can be queried with functions such as getStringAnnotations.