Język

Highlights.Builder.AddRanges(Paint, Int32[]) Method

Definition

Add multiple ranges highlight.

[Android.Runtime.Register("addRanges", "(Landroid/graphics/Paint;[I)Landroid/text/Highlights$Builder;", "", ApiSince=34)]
public Android.Text.Highlights.Builder AddRanges(Android.Graphics.Paint paint, params int[] ranges);
[<Android.Runtime.Register("addRanges", "(Landroid/graphics/Paint;[I)Landroid/text/Highlights$Builder;", "", ApiSince=34)>]
member this.AddRanges : Android.Graphics.Paint * int[] -> Android.Text.Highlights.Builder

Parameters

paint
Paint

a paint object used for drawing highlight path.

ranges
Int32[]

a flatten ranges. The 2 * i-th element is an inclusive start offset of the i-th character. The 2 * i + 1-th element is an exclusive end offset of the i-th character.

Returns

this builder instance.

Attributes

Remarks

Add multiple ranges highlight. For example, the following code draws (1, 2) with red and (2, 5) with blue. val redPaint = Paint().apply { color = Color.RED } val bluePaint = Paint().apply { color = Color.BLUE } val highlight = Highlights.Builder().addRange(redPaint, 1, 4).addRange(bluePaint, 2, 5).build()

Android reference for android.text.Highlights.Builder.addRanges.

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