語言

InputMethod.OnUpdateSelection 方法

定義

當應用程式回報文字新增選取區域時,會被呼叫。

[Android.Runtime.Register("onUpdateSelection", "(IIIIII)V", "GetOnUpdateSelection_IIIIIIHandler", ApiSince=33)]
public virtual void OnUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd);
[<Android.Runtime.Register("onUpdateSelection", "(IIIIII)V", "GetOnUpdateSelection_IIIIIIHandler", ApiSince=33)>]
abstract member OnUpdateSelection : int * int * int * int * int * int -> unit
override this.OnUpdateSelection : int * int * int * int * int * int -> unit

參數

oldSelStart
Int32

前一則文字偏移了選取的開頭。

oldSelEnd
Int32

前一文字偏移了選擇結束的部分。

newSelStart
Int32

新文字偏移了選擇的開頭。

newSelEnd
Int32

新文字抵消了選擇結束的效果。

candidatesStart
Int32

即當前作曲文本起始位置的文字偏移量,或 -1 若無寫作區域。

candidatesEnd
Int32

當前排版文字結束處的文字偏移量,或 -1 若沒有排版區域。

屬性

備註

當應用程式回報文字新增選取區域時,會被呼叫。 此呼叫稱為「無論無障礙服務是否已請求擷取的文字更新,」但若有,則若已調整,則不會收到此呼叫。

對於回應這個呼叫,使用 setComposingText、commitText 或 deleteSurroundingText 等方法來更改文字時,要小心。 若游標因此移動,該方法將再次被呼叫,可能導致無限迴圈。

Java 文件 android.accessibilityservice.InputMethod.onUpdateSelection(int, int, int, int, int, int)。

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

適用於