Språk

IInputConnectionExtensions.ReplaceText Method

Definition

Replace the specific range in the editor with suggested text.

public static bool ReplaceText(this Android.Views.InputMethods.IInputConnection self, int start, int end, string text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
static member ReplaceText : Android.Views.InputMethods.IInputConnection * int * int * string * int * Android.Views.InputMethods.TextAttribute -> bool

Parameters

start
Int32

the character index where the replacement should start. Value is 0 or greater

end
Int32

the character index where the replacement should end. Value is 0 or greater

text
String

the text to replace. This may include styles. This value cannot be null.

newCursorPosition
Int32

the new cursor position around the text. If > 0, this is relative to the end of the text - 1; if <= 0, this is relative to the start of the text. So a value of 1 will always advance you to the position after the full text being inserted. Note that this means you can't position the cursor within the text.

textAttribute
TextAttribute

The extra information about the text. This value may be null.

Returns

true if the replace command was sent to the associated editor (regardless of whether the replacement is success or not), false otherwise.

Remarks

Replace the specific range in the editor with suggested text.

Android reference for android.view.inputmethod.InputConnection.replaceText.

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