Added in API level 1

RelativeSizeSpan


open class RelativeSizeSpan : MetricAffectingSpan, ParcelableSpan

Uniformly scales the size of the text to which it's attached by a certain proportion.

For example, a RelativeSizeSpan that increases the text size by 50% can be constructed like this:

<code>SpannableString string = new SpannableString("Text with relative size span");
 string.setSpan(new RelativeSizeSpan(1.5f), 10, 24, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
Text increased by 50% with RelativeSizeSpan.

Summary

Public constructors

Creates a RelativeSizeSpan from a parcel.

RelativeSizeSpan(proportion: Float)

Creates a RelativeSizeSpan based on a proportion.

Public methods
open Int

open Float

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
MetricAffectingSpan! getUnderlying()

Returns "this" for most MetricAffectingSpans, but for MetricAffectingSpans that were generated by wrap, returns the underlying MetricAffectingSpan.

Unit updateDrawState(tp: TextPaint!)

CharacterStyle! wrap(cs: CharacterStyle!)

A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict.

Public constructors

RelativeSizeSpan

Added in API level 3
RelativeSizeSpan(src: Parcel)

Creates a RelativeSizeSpan from a parcel.

Parameters
src Parcel: This value cannot be null.

RelativeSizeSpan

Added in API level 1
RelativeSizeSpan(proportion: Float)

Creates a RelativeSizeSpan based on a proportion.

Parameters
proportion Float: the proportion with which the text is scaled. Value is 0 or greater

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

getSizeChange

Added in API level 1
open fun getSizeChange(): Float
Return
Float the proportion with which the text size is changed.

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