EditorInfo.GetInitialSurroundingText(Int32, Int32, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得目前游標周圍的文字,包含游標前的文字 beforeLength 字元(選取開始)、游標後(選取結束)後的文字 afterLength 字元,以及所有所選文字。
[Android.Runtime.Register("getInitialSurroundingText", "(III)Landroid/view/inputmethod/SurroundingText;", "GetGetInitialSurroundingText_IIIHandler", ApiSince=31)]
public virtual Android.Views.InputMethods.SurroundingText? GetInitialSurroundingText(int beforeLength, int afterLength, int flags);
[<Android.Runtime.Register("getInitialSurroundingText", "(III)Landroid/view/inputmethod/SurroundingText;", "GetGetInitialSurroundingText_IIIHandler", ApiSince=31)>]
abstract member GetInitialSurroundingText : int * int * int -> Android.Views.InputMethods.SurroundingText
override this.GetInitialSurroundingText : int * int * int -> Android.Views.InputMethods.SurroundingText
參數
- beforeLength
- Int32
游標前文字的預期長度。
- afterLength
- Int32
游標後的文字預期長度。
- flags
- Int32
提供更多選項來控制文字回傳方式。 可能是其中之一0InputConnection#GET_TEXT_WITH_STYLES。
傳回
描述 android.view.inputmethod.SurroundingText 周圍文字及選取狀態的物件,或 null 編輯器或系統無法支援此協定時。
- 屬性
備註
取得目前游標周圍的文字,包含游標前的文字 beforeLength 字元(選取開始)、游標後(選取結束)後的文字 afterLength 字元,以及所有所選文字。
回郵的初始文字若過大可裁切。 基本修剪規則包括:
<ul><li>游標前的文字是IME中最重要的資訊。</li><>游標後的文字是 IME 的第二個重要資訊。</li><>li 所選文本是最不重要的資訊,但絕不可被截斷。 太長了就放棄。</li></ul>
例如,子文本可視為 TextBeforeCursor + Selection + TextAfterCursor。 結果可能是:
<ol><li>(maybeTrimmedAtHead)TextBeforeCursor + Selection + TextAfterCursor(maybeTrimmedAtTail)</li<>li>(maybeTrimmedAtHead)TextBeforeCursor + TextAfterCursor(maybeTrimmedAtTail)</li></ol>
Java 文件 android.view.inputmethod.EditorInfo.getInitialSurroundingText(int, int, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。