DynamicLayout
open class DynamicLayout : Layout
| kotlin.Any | ||
| ↳ | android.text.Layout | |
| ↳ | android.text.DynamicLayout | |
DynamicLayout is a text layout that updates itself as the text is edited.
This is used by widgets to control text layout. You should not need to use this class directly unless you are implementing your own widget or custom display object, or need to call Canvas.drawText() directly.
Summary
| Nested classes | |
|---|---|
|
Builder for dynamic layouts. |
|
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
DynamicLayout(base: CharSequence, paint: TextPaint, width: Int, align: Layout.Alignment, spacingmult: Float, spacingadd: Float, includepad: Boolean) |
|
DynamicLayout(base: CharSequence, display: CharSequence, paint: TextPaint, width: Int, align: Layout.Alignment, spacingmult: Float, spacingadd: Float, includepad: Boolean) |
|
DynamicLayout(base: CharSequence, display: CharSequence, paint: TextPaint, width: Int, align: Layout.Alignment, spacingmult: Float, spacingadd: Float, includepad: Boolean, ellipsize: TextUtils.TruncateAt?, ellipsizedWidth: Int) |
|
| Public methods | |
|---|---|
| open Int |
Returns the number of extra pixels of descent padding in the bottom line of the Layout. |
| open Int |
getEllipsisCount(line: Int)Returns the number of characters to be ellipsized away, or 0 if no ellipsis is to take place. |
| open Int |
getEllipsisStart(line: Int)Return the offset of the first character to be ellipsized away, relative to the start of the line. |
| open Int |
Return the width to which this layout is ellipsized. |
| open LineBreakConfig |
Gets the |
| open Boolean |
getLineContainsTab(line: Int)Returns whether the specified line contains one or more characters that need to be handled specially, like tabs. |
| open Int |
Return the number of lines of text in this layout. |
| open Int |
getLineDescent(line: Int)Return the descent of the specified line(0…getLineCount() - 1). |
| Layout.Directions! |
getLineDirections(line: Int)Returns the directional run information for the specified line. |
| open Int |
getLineStart(line: Int)Return the text offset of the beginning of the specified line ( 0…getLineCount()). |
| open Int |
getLineTop(line: Int)Return the vertical position of the top of the specified line (0…getLineCount()). |
| open Int |
getParagraphDirection(line: Int)Returns the primary directionality of the paragraph containing the specified line, either 1 for left-to-right lines, or -1 for right-to-left lines (see |
| open Int |
Returns the (negative) number of extra pixels of ascent padding in the top line of the Layout. |
| Inherited functions | |
|---|---|
| Inherited properties | |
|---|---|
Public constructors
DynamicLayout
DynamicLayout(
base: CharSequence,
paint: TextPaint,
width: Int,
align: Layout.Alignment,
spacingmult: Float,
spacingadd: Float,
includepad: Boolean)
Deprecated: Use Builder instead.
| Parameters | |
|---|---|
base |
CharSequence: This value cannot be null. |
paint |
TextPaint: This value cannot be null. |
width |
Int: Value is 0 or greater |
align |
Layout.Alignment: This value cannot be null. |
spacingmult |
Float: Value is 0.0f or greater |
DynamicLayout
DynamicLayout(
base: CharSequence,
display: CharSequence,
paint: TextPaint,
width: Int,
align: Layout.Alignment,
spacingmult: Float,
spacingadd: Float,
includepad: Boolean)
Deprecated: Use Builder instead.
| Parameters | |
|---|---|
base |
CharSequence: This value cannot be null. |
display |
CharSequence: This value cannot be null. |
paint |
TextPaint: This value cannot be null. |
width |
Int: Value is 0 or greater |
align |
Layout.Alignment: This value cannot be null. |
spacingmult |
Float: Value is 0.0f or greater |
DynamicLayout
DynamicLayout(
base: CharSequence,
display: CharSequence,
paint: TextPaint,
width: Int,
align: Layout.Alignment,
spacingmult: Float,
spacingadd: Float,
includepad: Boolean,
ellipsize: TextUtils.TruncateAt?,
ellipsizedWidth: Int)
Deprecated: Use Builder instead.
| Parameters | |
|---|---|
base |
CharSequence: This value cannot be null. |
display |
CharSequence: This value cannot be null. |
paint |
TextPaint: This value cannot be null. |
width |
Int: Value is 0 or greater |
align |
Layout.Alignment: This value cannot be null. |
spacingmult |
Float: Value is 0.0f or greater |
ellipsize |
TextUtils.TruncateAt?: This value may be null. |
ellipsizedWidth |
Int: Value is 0 or greater |
Public methods
getBottomPadding
open fun getBottomPadding(): Int
Returns the number of extra pixels of descent padding in the bottom line of the Layout.
getEllipsisCount
open fun getEllipsisCount(line: Int): Int
Returns the number of characters to be ellipsized away, or 0 if no ellipsis is to take place.
getEllipsisStart
open fun getEllipsisStart(line: Int): Int
Return the offset of the first character to be ellipsized away, relative to the start of the line. (So 0 if the beginning of the line is ellipsized, not getLineStart().)
getEllipsizedWidth
open fun getEllipsizedWidth(): Int
Return the width to which this layout is ellipsized. If no ellipsize is applied, the same amount of getWidth is returned.
| Return | |
|---|---|
Int |
the amount of ellipsized width in pixels. Value is 0 or greater |
getLineBreakConfig
open fun getLineBreakConfig(): LineBreakConfig
Gets the LineBreakConfig used in this DynamicLayout. Use this only to consult the LineBreakConfig's properties and not to change them.
| Return | |
|---|---|
LineBreakConfig |
The line break config in this DynamicLayout. This value cannot be null. |
getLineContainsTab
open fun getLineContainsTab(line: Int): Boolean
Returns whether the specified line contains one or more characters that need to be handled specially, like tabs.
getLineCount
open fun getLineCount(): Int
Return the number of lines of text in this layout.
getLineDescent
open fun getLineDescent(line: Int): Int
Return the descent of the specified line(0…getLineCount() - 1).
getLineDirections
fun getLineDirections(line: Int): Layout.Directions!
Returns the directional run information for the specified line. The array alternates counts of characters in left-to-right and right-to-left segments of the line.
NOTE: this is inadequate to support bidirectional text, and will change.
getLineStart
open fun getLineStart(line: Int): Int
Return the text offset of the beginning of the specified line ( 0…getLineCount()). If the specified line is equal to the line count, returns the length of the text.
getLineTop
open fun getLineTop(line: Int): Int
Return the vertical position of the top of the specified line (0…getLineCount()). If the specified line is equal to the line count, returns the bottom of the last line.
getParagraphDirection
open fun getParagraphDirection(line: Int): Int
Returns the primary directionality of the paragraph containing the specified line, either 1 for left-to-right lines, or -1 for right-to-left lines (see DIR_LEFT_TO_RIGHT, DIR_RIGHT_TO_LEFT).
getTopPadding
open fun getTopPadding(): Int
Returns the (negative) number of extra pixels of ascent padding in the top line of the Layout.