Package icyllis.modernui.text.style
Class RelativeSizeSpan
java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.MetricAffectingSpan
icyllis.modernui.text.style.RelativeSizeSpan
- All Implemented Interfaces:
icyllis.modernui.text.ParcelableSpan,UpdateAppearance,UpdateLayout,Parcelable,Cloneable
public class RelativeSizeSpan
extends MetricAffectingSpan
implements icyllis.modernui.text.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:
SpannableString string = new SpannableString("Text with relative size span");
string.setSpan(new RelativeSizeSpan(1.5f), 10, 24, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags -
Constructor Summary
ConstructorsConstructorDescriptionRelativeSizeSpan(float proportion) Creates aRelativeSizeSpanbased on a proportion.RelativeSizeSpan(Parcel src) Creates aRelativeSizeSpanfrom a parcel. -
Method Summary
Modifier and TypeMethodDescriptionfloatintReturn a special type identifier for this span class.voidupdateMeasureState(TextPaint paint) Classes that extendMetricAffectingSpanimplement this method to update the text formatting in a way that can change the width or height of characters.voidwriteToParcel(Parcel dest, int flags) The subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.Methods inherited from class icyllis.modernui.text.style.MetricAffectingSpan
updateDrawStateMethods inherited from class icyllis.modernui.text.style.CharacterStyle
clone, wrap
-
Constructor Details
-
RelativeSizeSpan
public RelativeSizeSpan(float proportion) Creates aRelativeSizeSpanbased on a proportion.- Parameters:
proportion- the proportion with which the text is scaled.
-
RelativeSizeSpan
Creates aRelativeSizeSpanfrom a parcel.
-
-
Method Details
-
getSpanTypeId
public int getSpanTypeId()Return a special type identifier for this span class.- Specified by:
getSpanTypeIdin interfaceicyllis.modernui.text.ParcelableSpan
-
writeToParcel
Description copied from interface:ParcelableThe subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.- Specified by:
writeToParcelin interfaceParcelable- Parameters:
dest- the parcel to write the object's data toflags- the flags about how the object should be written
-
getSizeChange
public float getSizeChange()- Returns:
- the proportion with which the text size is changed.
-
updateMeasureState
Description copied from class:MetricAffectingSpanClasses that extendMetricAffectingSpanimplement this method to update the text formatting in a way that can change the width or height of characters.- Specified by:
updateMeasureStatein classMetricAffectingSpan- Parameters:
paint- the paint used for measuring the text
-