EditorInfo.SetInitialSurroundingSubText 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
SetInitialSurroundingSubText(ICharSequence, Int32) |
Editors may use this method to provide initial input text to IMEs. |
SetInitialSurroundingSubText(String, Int32) |
Editors may use this method to provide initial input text to IMEs. |
SetInitialSurroundingSubText(ICharSequence, Int32)
Editors may use this method to provide initial input text to IMEs.
[Android.Runtime.Register("setInitialSurroundingSubText", "(Ljava/lang/CharSequence;I)V", "GetSetInitialSurroundingSubText_Ljava_lang_CharSequence_IHandler", ApiSince=30)]
public virtual void SetInitialSurroundingSubText (Java.Lang.ICharSequence subText, int subTextStart);
[<Android.Runtime.Register("setInitialSurroundingSubText", "(Ljava/lang/CharSequence;I)V", "GetSetInitialSurroundingSubText_Ljava_lang_CharSequence_IHandler", ApiSince=30)>]
abstract member SetInitialSurroundingSubText : Java.Lang.ICharSequence * int -> unit
override this.SetInitialSurroundingSubText : Java.Lang.ICharSequence * int -> unit
Parameters
- subText
- ICharSequence
The input text. When it was trimmed, subTextStart
must be provided
correctly.
- subTextStart
- Int32
The position that the input text got trimmed. For example, when the editor wants to trim out the first 10 chars, subTextStart should be 10.
- Attributes
Remarks
Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its View#onCreateInputConnection(EditorInfo)
callback. When trimming the input text is needed, call this method instead of setInitialSurroundingText(CharSequence)
and provide the trimmed position info. Always try to include the selected text within subText
to give the system best flexibility to choose where and how to trim subText
when necessary.
Starting from VERSION_CODES#S
, spans that do not implement Parcelable
will be automatically dropped.
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
SetInitialSurroundingSubText(String, Int32)
Editors may use this method to provide initial input text to IMEs.
public void SetInitialSurroundingSubText (string subText, int subTextStart);
member this.SetInitialSurroundingSubText : string * int -> unit
Parameters
- subText
- String
The input text. When it was trimmed, subTextStart
must be provided
correctly.
- subTextStart
- Int32
The position that the input text got trimmed. For example, when the editor wants to trim out the first 10 chars, subTextStart should be 10.
Remarks
Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its View#onCreateInputConnection(EditorInfo)
callback. When trimming the input text is needed, call this method instead of setInitialSurroundingText(CharSequence)
and provide the trimmed position info. Always try to include the selected text within subText
to give the system best flexibility to choose where and how to trim subText
when necessary.
Starting from VERSION_CODES#S
, spans that do not implement Parcelable
will be automatically dropped.
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.