Added in API level 1

BoringLayout

open class BoringLayout : Layout, TextUtils.EllipsizeCallback
kotlin.Any
   ↳ android.text.Layout
   ↳ android.text.BoringLayout

A BoringLayout is a very simple Layout implementation for text that fits on a single line and is all left-to-right characters. You will probably never want to make one of these yourself; if you do, be sure to call #isBoring first to make sure the text meets the criteria.

This class 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, in which case you are encouraged to use a Layout instead of calling Canvas.drawText() directly.

Summary

Nested classes
open

Inherited constants
Public constructors
BoringLayout(source: CharSequence!, paint: TextPaint!, outerwidth: Int, align: Layout.Alignment!, spacingMult: Float, spacingAdd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean)

BoringLayout(source: CharSequence!, paint: TextPaint!, outerWidth: Int, align: Layout.Alignment!, spacingMult: Float, spacingAdd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean, ellipsize: TextUtils.TruncateAt!, ellipsizedWidth: Int)

Public methods
open Unit
draw(c: Canvas!, highlight: Path!, highlightpaint: Paint!, cursorOffset: Int)

open Unit
ellipsized(start: Int, end: Int)

Callback for the ellipsizer to report what region it ellipsized.

open Int

open Int

open Int

open Int

open Int

open Boolean

open Int

open Int

Layout.Directions!

open Float
getLineMax(line: Int)

open Int

open Int
getLineTop(line: Int)

open Float

open Int

open Int

open static BoringLayout.Metrics!
isBoring(text: CharSequence!, paint: TextPaint!)

Determine and compute metrics if given text can be handled by BoringLayout.

open static BoringLayout.Metrics!
isBoring(text: CharSequence!, paint: TextPaint!, metrics: BoringLayout.Metrics!)

Determine and compute metrics if given text can be handled by BoringLayout.

open static BoringLayout!
make(source: CharSequence!, paint: TextPaint!, outerWidth: Int, align: Layout.Alignment!, spacingMult: Float, spacingAdd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean)

Utility function to construct a BoringLayout instance.

open static BoringLayout!
make(source: CharSequence!, paint: TextPaint!, outerWidth: Int, align: Layout.Alignment!, spacingmult: Float, spacingadd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean, ellipsize: TextUtils.TruncateAt!, ellipsizedWidth: Int)

Utility function to construct a BoringLayout instance.

open BoringLayout!
replaceOrMake(source: CharSequence!, paint: TextPaint!, outerwidth: Int, align: Layout.Alignment!, spacingMult: Float, spacingAdd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean)

Returns a BoringLayout for the specified text, potentially reusing this one if it is already suitable.

open BoringLayout!
replaceOrMake(source: CharSequence!, paint: TextPaint!, outerWidth: Int, align: Layout.Alignment!, spacingMult: Float, spacingAdd: Float, metrics: BoringLayout.Metrics!, includePad: Boolean, ellipsize: TextUtils.TruncateAt!, ellipsizedWidth: Int)

Returns a BoringLayout for the specified text, potentially reusing this one if it is already suitable.

Inherited functions

Public constructors

BoringLayout

Added in API level 1
BoringLayout(
    source: CharSequence!,
    paint: TextPaint!,
    outerwidth: Int,
    align: Layout.Alignment!,
    spacingMult: Float,
    spacingAdd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean)
Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerwidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingMult Float: this value is no longer used by BoringLayout
spacingAdd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts

BoringLayout

Added in API level 1
BoringLayout(
    source: CharSequence!,
    paint: TextPaint!,
    outerWidth: Int,
    align: Layout.Alignment!,
    spacingMult: Float,
    spacingAdd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean,
    ellipsize: TextUtils.TruncateAt!,
    ellipsizedWidth: Int)
Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerWidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingMult Float: this value is no longer used by BoringLayout
spacingAdd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts
ellipsize TextUtils.TruncateAt!: whether to ellipsize the text if width of the text is longer than the requested outerwidth
ellipsizedWidth Int: the width to which this Layout is ellipsizing. If ellipsize is null, or is TextUtils.TruncateAt#MARQUEE this value is not used, outerwidth is used instead

Public methods

draw

Added in API level 1
open fun draw(
    c: Canvas!,
    highlight: Path!,
    highlightpaint: Paint!,
    cursorOffset: Int
): Unit
Parameters
canvas the canvas
highlight Path!: the path of the highlight or cursor; can be null
highlightPaint the paint for the highlight
cursorOffsetVertical the amount to temporarily translate the canvas while rendering the highlight

ellipsized

Added in API level 1
open fun ellipsized(
    start: Int,
    end: Int
): Unit

Callback for the ellipsizer to report what region it ellipsized.

getBottomPadding

Added in API level 1
open fun getBottomPadding(): Int

getEllipsisCount

Added in API level 1
open fun getEllipsisCount(line: Int): Int

getEllipsisStart

Added in API level 1
open fun getEllipsisStart(line: Int): Int

getEllipsizedWidth

Added in API level 1
open fun getEllipsizedWidth(): Int

getHeight

Added in API level 1
open fun getHeight(): Int

getLineContainsTab

Added in API level 1
open fun getLineContainsTab(line: Int): Boolean

getLineCount

Added in API level 1
open fun getLineCount(): Int

getLineDescent

Added in API level 1
open fun getLineDescent(line: Int): Int

getLineDirections

Added in API level 1
fun getLineDirections(line: Int): Layout.Directions!

getLineMax

Added in API level 1
open fun getLineMax(line: Int): Float

getLineStart

Added in API level 1
open fun getLineStart(line: Int): Int

getLineTop

Added in API level 1
open fun getLineTop(line: Int): Int

getLineWidth

Added in API level 1
open fun getLineWidth(line: Int): Float

getParagraphDirection

Added in API level 1
open fun getParagraphDirection(line: Int): Int

getTopPadding

Added in API level 1
open fun getTopPadding(): Int

isBoring

Added in API level 1
open static fun isBoring(
    text: CharSequence!,
    paint: TextPaint!
): BoringLayout.Metrics!

Determine and compute metrics if given text can be handled by BoringLayout.

Parameters
text CharSequence!: a text
paint TextPaint!: a paint
Return
BoringLayout.Metrics! layout metric for the given text. null if given text is unable to be handled by BoringLayout.

isBoring

Added in API level 1
open static fun isBoring(
    text: CharSequence!,
    paint: TextPaint!,
    metrics: BoringLayout.Metrics!
): BoringLayout.Metrics!

Determine and compute metrics if given text can be handled by BoringLayout.

Parameters
text CharSequence!: a text
paint TextPaint!: a paint
metrics BoringLayout.Metrics!: a metrics object to be recycled. If null is passed, this function creat new object.
Return
BoringLayout.Metrics! layout metric for the given text. If metrics is not null, this method fills values to given metrics object instead of allocating new metrics object. null if given text is unable to be handled by BoringLayout.

make

Added in API level 1
open static fun make(
    source: CharSequence!,
    paint: TextPaint!,
    outerWidth: Int,
    align: Layout.Alignment!,
    spacingMult: Float,
    spacingAdd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean
): BoringLayout!

Utility function to construct a BoringLayout instance.

Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerWidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingMult Float: this value is no longer used by BoringLayout
spacingAdd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts

make

Added in API level 1
open static fun make(
    source: CharSequence!,
    paint: TextPaint!,
    outerWidth: Int,
    align: Layout.Alignment!,
    spacingmult: Float,
    spacingadd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean,
    ellipsize: TextUtils.TruncateAt!,
    ellipsizedWidth: Int
): BoringLayout!

Utility function to construct a BoringLayout instance.

Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerWidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingmult Float: this value is no longer used by BoringLayout
spacingadd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts
ellipsize TextUtils.TruncateAt!: whether to ellipsize the text if width of the text is longer than the requested width
ellipsizedWidth Int: the width to which this Layout is ellipsizing. If ellipsize is null, or is TextUtils.TruncateAt#MARQUEE this value is not used, outerWidth is used instead

replaceOrMake

Added in API level 1
open fun replaceOrMake(
    source: CharSequence!,
    paint: TextPaint!,
    outerwidth: Int,
    align: Layout.Alignment!,
    spacingMult: Float,
    spacingAdd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean
): BoringLayout!

Returns a BoringLayout for the specified text, potentially reusing this one if it is already suitable. The caller must make sure that no one is still using this Layout.

Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerwidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingMult Float: this value is no longer used by BoringLayout
spacingAdd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts

replaceOrMake

Added in API level 1
open fun replaceOrMake(
    source: CharSequence!,
    paint: TextPaint!,
    outerWidth: Int,
    align: Layout.Alignment!,
    spacingMult: Float,
    spacingAdd: Float,
    metrics: BoringLayout.Metrics!,
    includePad: Boolean,
    ellipsize: TextUtils.TruncateAt!,
    ellipsizedWidth: Int
): BoringLayout!

Returns a BoringLayout for the specified text, potentially reusing this one if it is already suitable. The caller must make sure that no one is still using this Layout.

Parameters
source CharSequence!: the text to render
paint TextPaint!: the default paint for the layout
outerWidth Int: the wrapping width for the text
align Layout.Alignment!: whether to left, right, or center the text
spacingMult Float: this value is no longer used by BoringLayout
spacingAdd Float: this value is no longer used by BoringLayout
metrics BoringLayout.Metrics!: Metrics instance that contains information about FontMetrics and line width
includePad Boolean: set whether to include extra space beyond font ascent and descent which is needed to avoid clipping in some scripts
ellipsize TextUtils.TruncateAt!: whether to ellipsize the text if width of the text is longer than the requested width
ellipsizedWidth Int: the width to which this Layout is ellipsizing. If ellipsize is null, or is TextUtils.TruncateAt#MARQUEE this value is not used, outerwidth is used instead