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>
Summary
| Public constructors | |
|---|---|
| AbsoluteSizeSpan(src: Parcel)Creates an  | |
| AbsoluteSizeSpan(size: Int)Set the text size to  | |
| AbsoluteSizeSpan(size: Int, dip: Boolean)Set the text size to  | |
| Public methods | |
|---|---|
| open Int | |
| open Boolean | getDip()Returns whether the size is in device-independent pixels or not, depending on the  | 
| open Int | getSize()Get the text size. | 
| open Int | |
| open String | toString() | 
| open Unit | updateDrawState(ds: TextPaint) | 
| 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
AbsoluteSizeSpan(src: Parcel)
Creates an AbsoluteSizeSpan from a parcel.
| Parameters | |
|---|---|
| src | Parcel: This value cannot be null. | 
AbsoluteSizeSpan
AbsoluteSizeSpan(size: Int)
Set the text size to size physical pixels.
AbsoluteSizeSpan
AbsoluteSizeSpan(
size: Int,
dip: Boolean)
Set the text size to size physical pixels, or to size device-independent pixels if dip is true.
Public methods
describeContents
open fun describeContents(): Int
| Return | |
|---|---|
| Int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0orandroid.os.Parcelable#CONTENTS_FILE_DESCRIPTOR | 
getDip
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 | trueif the size is in device-independent pixels,falseotherwise | 
See Also
getSize
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. | 
toString
open fun toString(): String
| Return | |
|---|---|
| String | a string representation of the object. | 
updateDrawState
open fun updateDrawState(ds: TextPaint): Unit
| Parameters | |
|---|---|
| ds | TextPaint: This value cannot be null. | 
updateMeasureState
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
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 either0or a combination ofandroid.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
