Package icyllis.modernui.text.style

# Class AbsoluteSizeSpan

java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.MetricAffectingSpan
icyllis.modernui.text.style.AbsoluteSizeSpan

All Implemented Interfaces:
  `ParcelableSpan`, `UpdateAppearance`, `UpdateLayout`, `Parcelable`

public class AbsoluteSizeSpan extends MetricAffectingSpan implements ParcelableSpan
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:

     SpannableString string = new SpannableString("Text with absolute size span");
     string.setSpan(new AbsoluteSizeSpan(55, true), 10, 23, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable

  `Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbsoluteSizeSpan(int size)`
  Set the text size to `size` physical pixels.
  `AbsoluteSizeSpan(int size, boolean scaled)`
  Set the text size to `size` physical pixels, or to `size` device-independent pixels if `scaled` is true.
  `AbsoluteSizeSpan(Parcel src)`
  Creates an `AbsoluteSizeSpan` from a parcel.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getSize()`
  Get the text size.
  `int`
  `getSpanTypeId()`
  Return a special type identifier for this span class.
  `boolean`
  `isScaled()`
  Returns whether the size is in device-independent pixels or not, depending on the `scaled` flag passed in `AbsoluteSizeSpan(int, boolean)`
  `void`
  `updateMeasureState(TextPaint paint)`
  Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
  `void`
  `writeToParcel(Parcel dest, int flags)`
  The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.

  ### Methods inherited from class icyllis.modernui.text.style.MetricAffectingSpan

  `getUnderlying, updateDrawState`

  ### Methods inherited from class icyllis.modernui.text.style.CharacterStyle

  `wrap`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbsoluteSizeSpan

    public AbsoluteSizeSpan(int size)
    Set the text size to `size` physical pixels.

  - ### AbsoluteSizeSpan

    public AbsoluteSizeSpan(int size, boolean scaled)
    Set the text size to `size` physical pixels, or to `size` device-independent pixels if `scaled` is true.

  - ### AbsoluteSizeSpan

    public AbsoluteSizeSpan(@NonNull Parcel src)
    Creates an `AbsoluteSizeSpan` from a parcel.

- ## Method Details

  - ### getSpanTypeId

    public int getSpanTypeId()
    Description copied from interface: `ParcelableSpan`
    Return a special type identifier for this span class.
    Specified by:
      `getSpanTypeId` in interface `ParcelableSpan`

  - ### writeToParcel

    public void writeToParcel(@NonNull Parcel dest, int flags)
    Description copied from interface: `Parcelable`
    The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.
    Specified by:
      `writeToParcel` in interface `Parcelable`
    Parameters:
      `dest` - the parcel to write the object's data to
      `flags` - the flags about how the object should be written

  - ### getSize

    public int getSize()
    Get the text size. This is in physical pixels if `isScaled()` returns false or in device-independent pixels if `isScaled()` returns true.
    Returns:
      the text size, either in physical pixels or device-independent pixels.
    See Also:
      - `AbsoluteSizeSpan(int, boolean)`

  - ### isScaled

    public boolean isScaled()
    Returns whether the size is in device-independent pixels or not, depending on the `scaled` flag passed in `AbsoluteSizeSpan(int, boolean)`
    Returns:
      `true` if the size is in device-independent pixels, `false` otherwise
    See Also:
      - `AbsoluteSizeSpan(int, boolean)`

  - ### updateMeasureState

    public void updateMeasureState(@NonNull TextPaint paint)
    Description copied from class: `MetricAffectingSpan`
    Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
    Specified by:
      `updateMeasureState` in class `MetricAffectingSpan`
    Parameters:
      `paint` - the paint used for measuring the text