Added in API level 1

RelativeSizeSpan


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

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

open Float

open Int

Return a special type identifier for this span class.

open String

Returns a string representation of the object.

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

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.0f or greater

Public methods

describeContents

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

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

Return a special type identifier for this span class.

toString

Added in API level 1
open fun toString(): String

Returns a string representation of the object.

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 the following: