Språk

BaseInputConnection.SetComposingRegion(Int32, Int32) Method

Definition

Mark a certain region of text as composing text.

[Android.Runtime.Register("setComposingRegion", "(II)Z", "GetSetComposingRegion_IIHandler")]
public virtual bool SetComposingRegion(int start, int end);
[<Android.Runtime.Register("setComposingRegion", "(II)Z", "GetSetComposingRegion_IIHandler")>]
abstract member SetComposingRegion : int * int -> bool
override this.SetComposingRegion : int * int -> bool

Parameters

start
Int32

the position in the text at which the composing region begins

end
Int32

the position in the text at which the composing region ends

Returns

true on success, false if the input connection is no longer valid. Since Android Build.VERSION_CODES.N until Build.VERSION_CODES.TIRAMISU, this API returned false when the target application does not implement this method.

Implements

Attributes

Remarks

Mark a certain region of text as composing text. If there was a composing region, the characters are left as they were and the composing span removed, as if finishComposingText() has been called. The default style for composing text is used.

The passed indices are clipped to the contents bounds. If the resulting region is zero-sized, no region is marked and the effect is the same as that of calling finishComposingText(). 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.

Since this does not change the contents of the text, editors should not call InputMethodManager.updateSelection(android.view.View,int,int,int,int) and IMEs should not receive InputMethodService.onUpdateSelection(int, int, int, int, int, int).

This has no impact on the cursor/selection position. It may result in the cursor being anywhere inside or outside the composing region, including cases where the selection and the composing region overlap partially or entirely.

Android reference for android.view.inputmethod.BaseInputConnection.setComposingRegion.

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