次の方法で共有


IInputConnection.ReplaceText Method

Definition

Overloads

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:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 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:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 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

the character index where the replacement should start.

end
Int32

the character index where the replacement should end.

text
ICharSequence

the text to replace. This may include styles.

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.

Attributes

Remarks

Replace the specific range in the editor with suggested text.

This method finishes whatever composing text is currently active and leaves the text as-it, replaces the specific range of text with the passed CharSequence, and then moves the cursor according to newCursorPosition. This behaves like calling #finishComposingText(), #setSelection(int, int) setSelection(start, end), and then #commitText(CharSequence, int, TextAttribute) commitText(text, newCursorPosition, textAttribute).

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.

Java documentation for android.view.inputmethod.InputConnection.replaceText(int, int, java.lang.CharSequence, int, android.view.inputmethod.TextAttribute).

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 virtual 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

the character index where the replacement should start.

end
Int32

the character index where the replacement should end.

text
String

the text to replace. This may include styles.

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.

This method finishes whatever composing text is currently active and leaves the text as-it, replaces the specific range of text with the passed CharSequence, and then moves the cursor according to newCursorPosition. This behaves like calling #finishComposingText(), #setSelection(int, int) setSelection(start, end), and then #commitText(CharSequence, int, TextAttribute) commitText(text, newCursorPosition, textAttribute).

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.

Java documentation for android.view.inputmethod.InputConnection.replaceText(int, int, java.lang.CharSequence, int, android.view.inputmethod.TextAttribute).

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