Added in API level 1

AbsoluteSizeSpan


open class AbsoluteSizeSpan : MetricAffectingSpan, ParcelableSpan
kotlin.Any
   ↳ android.text.style.CharacterStyle
   ↳ android.text.style.MetricAffectingSpan
   ↳ android.text.style.AbsoluteSizeSpan

A span that changes the size of the text it's attached to.

For example, the size of the text can be changed to 55dp like this:

<code>SpannableString string = new SpannableString("Text with absolute size span");
 string.setSpan(new AbsoluteSizeSpan(55, true), 10, 23, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
Text with text size updated.

Summary

Public constructors

Set the text size to size physical pixels.

Set the text size to size physical pixels, or to size device-independent pixels if dip is true.

Creates an AbsoluteSizeSpan from a parcel.

Public methods
open Int

open Boolean

Returns whether the size is in device-independent pixels or not, depending on the dip flag passed in AbsoluteSizeSpan(int,boolean)

open Int

Get the text size.

open Int

open String

open Unit

open Unit

Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.

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

Flatten this object in to a Parcel.

Inherited functions

Public constructors

AbsoluteSizeSpan

Added in API level 1
AbsoluteSizeSpan(size: Int)

Set the text size to size physical pixels.

AbsoluteSizeSpan

Added in API level 5
AbsoluteSizeSpan(
    size: Int,
    dip: Boolean)

Set the text size to size physical pixels, or to size device-independent pixels if dip is true.

AbsoluteSizeSpan

Added in API level 3
AbsoluteSizeSpan(src: Parcel)

Creates an AbsoluteSizeSpan from a parcel.

Parameters
src Parcel: This value cannot be null.

Public methods

describeContents

Added in API level 3
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

getDip

Added in API level 5
open fun getDip(): Boolean

Returns whether the size is in device-independent pixels or not, depending on the dip flag passed in AbsoluteSizeSpan(int,boolean)

Return
Boolean true if the size is in device-independent pixels, false otherwise

getSize

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

Get the text size. This is in physical pixels if getDip() returns false or in device-independent pixels if getDip() returns true.

Return
Int the text size, either in physical pixels or device-independent pixels.

getSpanTypeId

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

toString

Added in API level 1
open fun toString(): String
Return
String a string representation of the object.

updateDrawState

Added in API level 1
open fun updateDrawState(ds: TextPaint): Unit
Parameters
ds TextPaint: This value cannot be null.

updateMeasureState

Added in API level 1
open fun updateMeasureState(ds: TextPaint): Unit

Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.

Parameters
textPaint the paint used for drawing the text This value cannot be null.
ds TextPaint: This value cannot be null.

writeToParcel

Added in API level 3
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: 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