語言

TextBoundsInfo.GetRangeForRect 方法

定義

找出位於指定矩形區域內的文字範圍。

[Android.Runtime.Register("getRangeForRect", "(Landroid/graphics/RectF;Landroid/text/SegmentFinder;Landroid/text/Layout$TextInclusionStrategy;)[I", "", ApiSince=34)]
public int[]? GetRangeForRect(Android.Graphics.RectF area, Android.Text.SegmentFinder segmentFinder, Android.Text.Layout.ITextInclusionStrategy inclusionStrategy);
[<Android.Runtime.Register("getRangeForRect", "(Landroid/graphics/RectF;Landroid/text/SegmentFinder;Landroid/text/Layout$TextInclusionStrategy;)[I", "", ApiSince=34)>]
member this.GetRangeForRect : Android.Graphics.RectF * Android.Text.SegmentFinder * Android.Text.Layout.ITextInclusionStrategy -> int[]

參數

area
RectF

文字範圍將被找到的區域。 這個值不可能為零值。

segmentFinder
SegmentFinder

SegmentFinder 用於判定將視為文字段的範圍。 這個值不可能為零值。

inclusionStrategy
Layout.ITextInclusionStrategy

判斷文字段落是否位於指定區域內的策略。 這個值不可能為零值。

傳回

Int32[]

文字範圍儲存在一個兩元素整數陣列中。 第一個元素是文字範圍的起始(包含),第二個元素是文字範圍的結尾(排他)字元偏移量,若區域內沒有文字區段則為空值。

屬性

備註

找出位於指定矩形區域內的文字範圍。 此方法是 Layout.getRangeForRect(RectF,SegmentFinder,Layout.TextInclusionStrategy) 的對應方法。

假設編輯器會將文字從上到下排列成水平線,且每行依照 Unicode 雙向演算法所規定的顯示演算法排列。

此方法不會檢查缺少行資訊的文字範圍。 例如,假設 TextBoundsInfo 的範圍從索引 5 到 15,而相關的線段搜尋器只識別一個線範圍,從 7 到 12。 此方法不會檢查範圍 [5, 7) 和 [12, 15 之間的文字。

Android 參考資料。android.view.inputmethod.TextBoundsInfo.getRangeForRect

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於