IInputConnection.SetSelection(Int32, Int32) 方法

定義

設定文字編輯器的選擇。

[Android.Runtime.Register("setSelection", "(II)Z", "GetSetSelection_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool SetSelection(int start, int end);
[<Android.Runtime.Register("setSelection", "(II)Z", "GetSetSelection_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetSelection : int * int -> bool

參數

start
Int32

角色索引應該從選擇開始的位置。

end
Int32

字元索引應該在選擇結束的地方。

傳回

成功時為真;若輸入連線不再有效,則為假。

屬性

備註

設定文字編輯器的選擇。 要設定游標位置,開始和結束應該有相同的值。

由於此方法會移動游標,呼叫此方法會使編輯者在批次輸入結束後呼叫 android.inputmethodservice.InputMethodService#onUpdateSelection(int, int, int, int, int, int) 當前 IME。 <強編輯>作者<們/強者>,要做到這點,你需要透過呼叫 InputMethodManager#updateSelection(View, int, int, int, int)輸入法來告知這些變更,但如果批次編輯正在進行中,請小心等到批次編輯結束後再做。

這對作曲區域沒有影響,該區域必須保持不變。 開始和結束的順序並不重要。 實際上,從頭到尾的區域和從頭到尾的區域是相同的。 編輯作者們,請準備好接受一個比結尾更重要的開頭。

Java 文件 android.view.inputmethod.InputConnection.setSelection(int, int)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於