Share via


TextView.SetSearchResultHighlights(Int32[]) Method

Definition

Sets the search result ranges with flatten range representation.

[Android.Runtime.Register("setSearchResultHighlights", "([I)V", "GetSetSearchResultHighlights_arrayIHandler", ApiSince=34)]
public virtual void SetSearchResultHighlights (params int[]? ranges);
[<Android.Runtime.Register("setSearchResultHighlights", "([I)V", "GetSetSearchResultHighlights_arrayIHandler", ApiSince=34)>]
abstract member SetSearchResultHighlights : int[] -> unit
override this.SetSearchResultHighlights : int[] -> unit

Parameters

ranges
Int32[]

the flatten ranges of the search result. null for clear.

Attributes

Remarks

Sets the search result ranges with flatten range representation.

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].

TextView will render the search result with the highlights with specified color in the theme. If there is a focused search result, it is rendered with focused color. By calling this method, the focused search index will be cleared.

Java documentation for android.widget.TextView.setSearchResultHighlights(int...).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to