ScaleXSpan
open class ScaleXSpan : MetricAffectingSpan, ParcelableSpan
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 methods |
open Int |
|
open Float |
Get the horizontal scale factor for the text.
|
open Int |
|
open String |
|
open Unit |
|
open Unit |
|
open Unit |
Flatten this object in to a Parcel.
|
Inherited functions |
From class MetricAffectingSpan
MetricAffectingSpan! |
getUnderlying()
Returns "this" for most MetricAffectingSpans, but for MetricAffectingSpans that were generated by wrap , returns the underlying MetricAffectingSpan.
|
|
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
ScaleXSpan
ScaleXSpan(src: Parcel)
Creates a ScaleXSpan
from a parcel.
Parameters |
src |
Parcel: This value cannot be null . |
ScaleXSpan
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 or greater |
Public methods
describeContents
open fun describeContents(): Int
getScaleX
open fun getScaleX(): Float
Get the horizontal scale factor for the text.
Return |
Float |
the horizontal scale factor. |
getSpanTypeId
open fun getSpanTypeId(): Int
toString
open fun toString(): String
Return |
String |
a string representation of the object. |
updateMeasureState
open fun updateMeasureState(ds: TextPaint): Unit
Parameters |
textPaint |
the paint used for drawing the text This value cannot be null . |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]