Język

Layout.GetRangeForRect Method

Definition

Finds the range of text which is inside the specified rectangle area.

[Android.Runtime.Register("getRangeForRect", "(Landroid/graphics/RectF;Landroid/text/SegmentFinder;Landroid/text/Layout$TextInclusionStrategy;)[I", "GetGetRangeForRect_Landroid_graphics_RectF_Landroid_text_SegmentFinder_Landroid_text_Layout_TextInclusionStrategy_Handler", ApiSince=34)]
public virtual 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", "GetGetRangeForRect_Landroid_graphics_RectF_Landroid_text_SegmentFinder_Landroid_text_Layout_TextInclusionStrategy_Handler", ApiSince=34)>]
abstract member GetRangeForRect : Android.Graphics.RectF * Android.Text.SegmentFinder * Android.Text.Layout.ITextInclusionStrategy -> int[]
override this.GetRangeForRect : Android.Graphics.RectF * Android.Text.SegmentFinder * Android.Text.Layout.ITextInclusionStrategy -> int[]

Parameters

area
RectF

area for which the text range will be found. This value cannot be null.

segmentFinder
SegmentFinder

SegmentFinder for determining the ranges of text to be considered as a text segment. This value cannot be null.

inclusionStrategy
Layout.ITextInclusionStrategy

strategy for determining whether a text segment is inside the specified area. This value cannot be null.

Returns

Int32[]

int array of size 2 containing the start (inclusive) and end (exclusive) character offsets of the text range, or null if there are no text segments inside the area

Attributes

Remarks

Finds the range of text which is inside the specified rectangle area. The start of the range is the start of the first text segment inside the area, and the end of the range is the end of the last text segment inside the area.

A text segment is considered to be inside the area according to the provided TextInclusionStrategy. If a text segment spans multiple lines or multiple directional runs (e.g. a hyphenated word), the text segment is divided into pieces at the line and run breaks, then the text segment is considered to be inside the area if any of its pieces are inside the area.

The returned range may also include text segments which are not inside the specified area, if those text segments are in between text segments which are inside the area. For example, the returned range may be "segment1 segment2 segment3" if "segment1" and "segment3" are inside the area and "segment2" is not.

Android reference for android.text.Layout.getRangeForRect.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to