Added in API level 1

ScaleXSpan


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

Scales horizontally the size of the text to which it's attached by a certain factor.

Values > 1.0 will stretch the text wider. Values < 1.0 will stretch the text narrower.

For example, a ScaleXSpan that stretches the text size by 100% can be constructed like this:

<code>SpannableString string = new SpannableString("Text with ScaleX span");
 string.setSpan(new ScaleXSpan(2f), 10, 16, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
Text scaled by 100% with ScaleXSpan.

Summary

Public constructors

Creates a ScaleXSpan from a parcel.

ScaleXSpan(proportion: Float)

Creates a ScaleXSpan based on a proportion.

Public methods
open Int

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

open Float

Get the horizontal scale factor for the text.

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

ScaleXSpan

Added in API level 3
ScaleXSpan(src: Parcel)

Creates a ScaleXSpan from a parcel.

Parameters
src Parcel: This value cannot be null.

ScaleXSpan

Added in API level 1
ScaleXSpan(proportion: Float)

Creates a ScaleXSpan based on a proportion. Values > 1.0 will stretch the text wider. Values < 1.0 will stretch the text narrower.

Parameters
proportion Float: the horizontal scale factor.
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

getScaleX

Added in API level 1
open fun getScaleX(): Float

Get the horizontal scale factor for the text.

Return
Float the horizontal scale factor.

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

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.

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: