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 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 |
Flatten this object in to a Parcel.
|
Inherited functions |
|
From class CharacterStyle
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
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
open fun describeContents(): Int
getSizeChange
open fun getSizeChange(): Float
Return |
Float |
the proportion with which the text size is changed. |
getSpanTypeId
open fun getSpanTypeId(): Int
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.