BaseInputConnection.ReplaceText Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| ReplaceText(Int32, Int32, ICharSequence, Int32, TextAttribute) |
Replace the specific range in the editor with suggested text. |
| ReplaceText(Int32, Int32, String, Int32, TextAttribute) |
Replace the specific range in the editor with suggested text. |
ReplaceText(Int32, Int32, ICharSequence, Int32, TextAttribute)
Replace the specific range in the editor with suggested text.
[Android.Runtime.Register("replaceText", "(IILjava/lang/CharSequence;ILandroid/view/inputmethod/TextAttribute;)Z", "GetReplaceText_IILjava_lang_CharSequence_ILandroid_view_inputmethod_TextAttribute_Handler", ApiSince=34)]
public virtual bool ReplaceText(int start, int end, Java.Lang.ICharSequence text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
[<Android.Runtime.Register("replaceText", "(IILjava/lang/CharSequence;ILandroid/view/inputmethod/TextAttribute;)Z", "GetReplaceText_IILjava_lang_CharSequence_ILandroid_view_inputmethod_TextAttribute_Handler", ApiSince=34)>]
abstract member ReplaceText : int * int * Java.Lang.ICharSequence * int * Android.Views.InputMethods.TextAttribute -> bool
override this.ReplaceText : int * int * Java.Lang.ICharSequence * int * Android.Views.InputMethods.TextAttribute -> bool
Parameters
- start
- Int32
Value is 0 or greater
- end
- Int32
Value is 0 or greater
- text
- ICharSequence
The replacement text for the specified range.
- 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
Optional text metadata; the base implementation does not use this argument.
Returns
The default implementation returns true when an editable buffer is available, or false otherwise.
Implements
- Attributes
Remarks
Replace the specific range in the editor with suggested text.
The default implementation removes composing spans, clips the range to the editable buffer, replaces that range with the supplied text, and moves the cursor according to newCursorPosition.
Similar to setSelection(int, int), 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.
Android reference for android.view.inputmethod.BaseInputConnection.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
ReplaceText(Int32, Int32, String, Int32, TextAttribute)
Replace the specific range in the editor with suggested text.
public bool ReplaceText(int start, int end, string text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
abstract member ReplaceText : int * int * string * int * Android.Views.InputMethods.TextAttribute -> bool
override this.ReplaceText : int * int * string * int * Android.Views.InputMethods.TextAttribute -> bool
Parameters
- start
- Int32
Value is 0 or greater
- end
- Int32
Value is 0 or greater
- text
- String
The replacement string for the specified range.
- 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
Optional text metadata passed to the character sequence overload.
Returns
The result of the character sequence overload. Its default implementation returns true when an editable buffer is available, or false otherwise.
Implements
Remarks
Replace the specific range in the editor with suggested text.
The default implementation removes composing spans, clips the range to the editable buffer, replaces that range with the supplied text, and moves the cursor according to newCursorPosition.
Similar to setSelection(int, int), 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.
Android reference for android.view.inputmethod.BaseInputConnection.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.