Unit |
draw(c: Canvas!)
Draw this Layout on the specified Canvas. This API draws background first, then draws text on top of it.
|
Unit |
draw(canvas: Canvas!, selectionHighlight: Path!, selectionHighlightPaint: Paint!, cursorOffsetVertical: Int)
Draw this Layout on the specified canvas, with the highlight path drawn between the background and the text.
|
Unit |
draw(canvas: Canvas, highlightPaths: MutableList<Path!>?, highlightPaints: MutableList<Paint!>?, selectionPath: Path?, selectionPaint: Paint?, cursorOffsetVertical: Int)
Draw this layout on the specified canvas. This API draws background first, then draws highlight paths on top of it, then draws selection or cursor, then finally draws text on top of it.
|
Unit |
drawBackground(canvas: Canvas)
Draw background of this layout. Different from draw(android.graphics.Canvas,java.util.List,java.util.List,android.graphics.Path,android.graphics.Paint,int) API, this API only draws background, not drawing text, highlights or selections. The background here is drawn by LineBackgroundSpan attached to the text.
|
Unit |
drawText(canvas: Canvas)
Draw text part of this layout. Different from draw(android.graphics.Canvas,java.util.List,java.util.List,android.graphics.Path,android.graphics.Paint,int) API, this API only draws text part, not drawing highlights, selections, or backgrounds.
|
Unit |
fillCharacterBounds(start: Int, end: Int, bounds: FloatArray, boundsStart: Int)
Return the characters' bounds in the given range. The bounds array will be filled starting from boundsStart (inclusive). The coordinates are in local text layout.
|
Layout.Alignment |
getAlignment()
Returns the alignment used for creating this layout in pixels.
|
Int |
getBreakStrategy()
Return the break strategy used for creating this layout.
|
Unit |
getCursorPath(point: Int, dest: Path!, editingBuffer: CharSequence!)
Fills in the specified Path with a representation of a cursor at the specified offset. This will often be a vertical line but can be multiple discontinuous lines in text with multiple directionalities.
|
Float |
getDesiredWidth(source: CharSequence!, paint: TextPaint!)
Return how wide a layout must be in order to display the specified text with one line per paragraph.
As of O, Uses TextDirectionHeuristics#FIRSTSTRONG_LTR as the default text direction heuristics. In the earlier versions uses TextDirectionHeuristics#LTR as the default.
|
Float |
getDesiredWidth(source: CharSequence!, start: Int, end: Int, paint: TextPaint!)
Return how wide a layout must be in order to display the specified text slice with one line per paragraph.
As of O, Uses TextDirectionHeuristics#FIRSTSTRONG_LTR as the default text direction heuristics. In the earlier versions uses TextDirectionHeuristics#LTR as the default.
|
TextUtils.TruncateAt? |
getEllipsize()
Return the ellipsize option used for creating this layout. May return null if no ellipsize option was selected.
|
Int |
getEllipsizedWidth()
Return the width to which this layout is ellipsized. If no ellipsize is applied, the same amount of getWidth is returned.
|
Int |
getHeight()
Return the total height of this layout.
|
Int |
getHyphenationFrequency()
Return the hyphenation frequency used for creating this layout.
|
Int |
getJustificationMode()
Return the justification mode used for creating this layout.
|
IntArray? |
getLeftIndents()
Return a copy of the left indents used for this layout. May return null if no left indentation is applied.
|
Int |
getLineAscent(line: Int)
Get the ascent of the text on the specified line. The return value is negative to match the Paint.ascent() convention.
|
Int |
getLineBaseline(line: Int)
Return the vertical position of the baseline of the specified line.
|
Int |
getLineBottom(line: Int)
Return the vertical position of the bottom of the specified line.
|
Int |
getLineBottom(line: Int, includeLineSpacing: Boolean)
Return the vertical position of the bottom of the specified line.
|
Int |
getLineBounds(line: Int, bounds: Rect!)
Return the baseline for the specified line (0…getLineCount() - 1) If bounds is not null, return the top, left, right, bottom extents of the specified line in it.
|
LineBreakConfig |
getLineBreakConfig()
Gets the LineBreakConfig used for creating this layout. Do not modify the returned object.
|
Int |
getLineEnd(line: Int)
Return the text offset after the last character on the specified line.
|
Int |
getLineForOffset(offset: Int)
Get the line number on which the specified text offset appears. If you ask for a position before 0, you get 0; if you ask for a position beyond the end of the text, you get the last line.
|
Float |
getLineLeft(line: Int)
Get the leftmost position that should be exposed for horizontal scrolling on the specified line.
|
Int |
getLineLetterSpacingUnitCount(line: Int, includeTrailingWhitespace: Boolean)
Returns the number of letter spacing unit in the line.
This API returns a number of letters that is a target of letter spacing. The letter spacing won't be added to the middle of the characters that are needed to be treated as a single, e.g., ligatured or conjunct form. Note that this value is different from the number of] grapheme clusters that is calculated by BreakIterator#getCharacterInstance(Locale) . For example, if the "fi" is ligatured, the ligatured form is treated as single uni and letter spacing is not added, but it has two separate grapheme cluster.
This value is used for calculating the letter spacing amount for the justification because the letter spacing is applied between clusters. For example, if extra W pixels needed to be filled by letter spacing, the amount of letter spacing to be applied is W /(letter spacing unit count - 1) px.
|
Float |
getLineMax(line: Int)
Gets the unsigned horizontal extent of the specified line, including leading margin indent, but excluding trailing whitespace.
|
Float |
getLineRight(line: Int)
Get the rightmost position that should be exposed for horizontal scrolling on the specified line.
|
Float |
getLineSpacingAmount()
Returns the amount added to the line height.
|
Float |
getLineSpacingMultiplier()
Returns the multiplier applied to the line height.
|
Int |
getLineVisibleEnd(line: Int)
Return the text offset after the last visible character (so whitespace is not counted) on the specified line.
|
Float |
getLineWidth(line: Int)
Gets the unsigned horizontal extent of the specified line, including leading margin indent and trailing whitespace.
|
Int |
getMaxLines()
Return the maximum lines allowed used for creating this layout. Note that this is not an actual line count of this layout. Use getLineCount() for getting the actual line count of this layout.
|
Paint.FontMetrics? |
getMinimumFontMetrics()
Get the minimum font metrics used for line spacing.
|
Int |
getOffsetForHorizontal(line: Int, horiz: Float)
Get the character offset on the specified line whose position is closest to the specified horizontal position.
|
Int |
getOffsetToLeftOf(offset: Int)
|
Int |
getOffsetToRightOf(offset: Int)
|
TextPaint |
getPaint()
Return the paint used for creating this layout. Do not modify the returned paint object. This paint object will still be used for drawing/measuring text.
|
Layout.Alignment! |
getParagraphAlignment(line: Int)
Get the alignment of the specified paragraph, taking into account markup attached to it.
|
Int |
getParagraphLeft(line: Int)
Get the left edge of the specified paragraph, inset by left margins.
|
Int |
getParagraphRight(line: Int)
Get the right edge of the specified paragraph, inset by right margins.
|
Float |
getPrimaryHorizontal(offset: Int)
Get the primary horizontal position for the specified text offset. This is the location where a new character would be inserted in the paragraph's primary direction.
|
IntArray? |
getRangeForRect(area: RectF, segmentFinder: SegmentFinder, inclusionStrategy: Layout.TextInclusionStrategy)
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.
|
IntArray? |
getRightIndents()
Return a copy of the right indents used for this layout. May return null if no right indentation is applied.
|
Float |
getSecondaryHorizontal(offset: Int)
Get the secondary horizontal position for the specified text offset. This is the location where a new character would be inserted in the direction other than the paragraph's primary direction.
|
Unit |
getSelectionPath(start: Int, end: Int, dest: Path!)
Fills in the specified Path with a representation of a highlight between the specified offsets. This will often be a rectangle or a potentially discontinuous set of rectangles. If the start and end are the same, the returned path is empty.
|
Boolean |
getShiftDrawingOffsetForStartOverhang()
Returns true if shifting drawing offset for start overhang.
|
Float |
getSpacingAdd()
Returns the amount added to the line height.
|
Float |
getSpacingMultiplier()
Returns the multiplier applied to the line height.
|
CharSequence |
getText()
Return the text used for creating this layout.
|
TextDirectionHeuristic |
getTextDirectionHeuristic()
Returns the text direction heuristic used for creating this layout.
|
Boolean |
getUseBoundsForWidth()
Returns true if using bounding box as a width, false for using advance as a width.
|
Int |
getWidth()
Return the width used for creating this layout in pixels.
|
Unit |
increaseWidthTo(wid: Int)
Increase the width of this layout to the specified width. Be careful to use this only when you know it is appropriate— it does not cause the text to reflow to use the full new width.
|
Boolean |
isFallbackLineSpacingEnabled()
Return true if the fallback line space is enabled in this Layout.
|
Boolean |
isFontPaddingIncluded()
Returns true if this layout is created with increased line height.
|
Boolean |
isRtlCharAt(offset: Int)
Returns true if the character at offset is right to left (RTL).
|
Boolean |
isSpanned()
|