BaseInputConnection.ReplaceText 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| ReplaceText(Int32, Int32, ICharSequence, Int32, TextAttribute) |
在編輯器中將特定範圍替換成建議文字。 |
| ReplaceText(Int32, Int32, String, Int32, TextAttribute) |
在編輯器中將特定範圍替換成建議文字。 |
ReplaceText(Int32, Int32, ICharSequence, Int32, TextAttribute)
在編輯器中將特定範圍替換成建議文字。
[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
參數
- start
- Int32
值為 0 或以上
- end
- Int32
值為 0 或以上
- text
- ICharSequence
指定範圍的替換文字。
- newCursorPosition
- Int32
文字周圍的新游標位置。 若 > 0,則相對於文本結尾為 - 1;若 <= 0,則相對於文本開頭。 所以值為 1 時,你總是會跳到插入全文之後的位置。 請注意,這代表你無法將游標置於文字中。
- textAttribute
- TextAttribute
可選的文字元資料;基礎實作並未使用此參數。
傳回
預設實作會在有可編輯緩衝區可用或false不存在時回傳true。
實作
- 屬性
備註
在編輯器中將特定範圍替換成建議文字。
預設實作會移除排版範圍,將範圍剪裁到可編輯緩衝區,將該範圍以提供的文字取代,並依 newCursorPosition 移動游標。
與 setSelection(int, int) 類似,起始與結束的順序並不重要。 實際上,從頭到尾的區域和從頭到尾的區域是相同的。 編輯作者們,請準備好接受一個比結尾更重要的開頭。
Android 參考資料。android.view.inputmethod.BaseInputConnection.replaceText
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
ReplaceText(Int32, Int32, String, Int32, TextAttribute)
在編輯器中將特定範圍替換成建議文字。
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
參數
- start
- Int32
值為 0 或以上
- end
- Int32
值為 0 或以上
- text
- String
指定範圍的替換字串。
- newCursorPosition
- Int32
文字周圍的新游標位置。 若 > 0,則相對於文本結尾為 - 1;若 <= 0,則相對於文本開頭。 所以值為 1 時,你總是會跳到插入全文之後的位置。 請注意,這代表你無法將游標置於文字中。
- textAttribute
- TextAttribute
可選的文字元資料傳遞給字元序列過載。
傳回
字元序列過載的結果。 其預設實作會在有可編輯緩衝區可用時回傳,否則false會回傳true。
實作
備註
在編輯器中將特定範圍替換成建議文字。
預設實作會移除排版範圍,將範圍剪裁到可編輯緩衝區,將該範圍以提供的文字取代,並依 newCursorPosition 移動游標。
與 setSelection(int, int) 類似,起始與結束的順序並不重要。 實際上,從頭到尾的區域和從頭到尾的區域是相同的。 編輯作者們,請準備好接受一個比結尾更重要的開頭。
Android 參考資料。android.view.inputmethod.BaseInputConnection.replaceText
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。