Added in API level 29

Standard


open class Standard : LineHeightSpan, ParcelableSpan
kotlin.Any
   ↳ android.text.style.LineHeightSpan.Standard

Default implementation of the LineHeightSpan, which changes the line height of the attached paragraph.

For example, a paragraph with its line height equal to 100px can be set like this:

SpannableString string = new SpannableString("This is a multiline paragraph. This is a multiline paragraph.");
  string.setSpan(new LineHeightSpan.Standard(100), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  
Text with line height set to 100 pixels.

Notice that LineHeightSpan will change the line height of the entire paragraph, even though it covers only part of the paragraph.

Summary

Public constructors
Standard(height: Int)

Set the line height of the paragraph to height physical pixels.

Constructor called from TextUtils to restore the span from a parcel

Public methods
open Unit
chooseHeight(text: CharSequence, start: Int, end: Int, spanstartv: Int, lineHeight: Int, fm: Paint.FontMetricsInt)

Classes that implement this should define how the height is being calculated.

open Int

open Int

Returns the line height specified by this span.

open Int

open Unit
writeToParcel(dest: Parcel, flags: Int)

Public constructors

Standard

Added in API level 29
Standard(height: Int)

Set the line height of the paragraph to height physical pixels.

Parameters
height Int: The units of this value are pixels. Value is 1 or greater

Standard

Added in API level 29
Standard(src: Parcel)

Constructor called from TextUtils to restore the span from a parcel

Parameters
src Parcel: This value cannot be null.

Public methods

chooseHeight

Added in API level 29
open fun chooseHeight(
    text: CharSequence,
    start: Int,
    end: Int,
    spanstartv: Int,
    lineHeight: Int,
    fm: Paint.FontMetricsInt
): Unit

Classes that implement this should define how the height is being calculated.

Parameters
text CharSequence: This value cannot be null.
start Int: the start of the line
end Int: the end of the line
spanstartv Int: the start of the span
lineHeight Int: the line height
fm Paint.FontMetricsInt: This value cannot be null.

describeContents

Added in API level 29
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getHeight

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

Returns the line height specified by this span.
The units of this value are pixels.

Return
Int The units of this value are pixels. {}

getSpanTypeId

Added in API level 29
open fun getSpanTypeId(): Int

writeToParcel

Added in API level 29
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES