Sdílet prostřednictvím


InputMethod.AccessibilityInputConnection.SetSelection(Int32, Int32) Method

Definition

Set the selection of the text editor.

[Android.Runtime.Register("setSelection", "(II)V", "", ApiSince=33)]
public void SetSelection (int start, int end);
[<Android.Runtime.Register("setSelection", "(II)V", "", ApiSince=33)>]
member this.SetSelection : int * int -> unit

Parameters

start
Int32

the character index where the selection should start.

end
Int32

the character index where the selection should end.

Attributes

Remarks

Set the selection of the text editor. To set the cursor position, start and end should have the same value.

Since this moves the cursor, calling this method will cause the editor to call android.inputmethodservice.InputMethodService#onUpdateSelection(int, int, int, int,int, int) on the current IME after the batch input is over. <strong>Editor authors</strong>, for this to happen you need to make the changes known to the input method by calling InputMethodManager#updateSelection(android.view.View, int, int, int, int), but be careful to wait until the batch edit is over if one is in progress.

This has no effect on the composing region which must stay unchanged. The order of start and end is not important. In effect, the region from start to end and the region from end to start is the same. Editor authors, be ready to accept a start that is greater than end.

Java documentation for android.accessibilityservice.InputMethod.AccessibilityInputConnection.setSelection(int, 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