Standard
open class Standard : LineHeightSpan, ParcelableSpan
kotlin.Any | |
↳ | android.text.style.LineHeightSpan.Standard |
Default implementation of the LineHeightSpan
, which changes the line height of the attached paragraph.
For example, a paragraph with its line height equal to 100px can be set like this:
SpannableString string = new SpannableString("This is a multiline paragraph. This is a multiline paragraph."); string.setSpan(new LineHeightSpan.Standard(100), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Notice that LineHeightSpan will change the line height of the entire paragraph, even though it covers only part of the paragraph.
Summary
Public constructors | |
---|---|
Constructor called from |
|
Set the line height of the paragraph to |
Public methods | |
---|---|
open Unit |
chooseHeight(text: CharSequence, start: Int, end: Int, spanstartv: Int, lineHeight: Int, fm: Paint.FontMetricsInt) Classes that implement this should define how the height is being calculated. |
open Int | |
open Int |
Returns the line height specified by this span. |
open Int | |
open Unit |
writeToParcel(dest: Parcel, flags: Int) |
Public constructors
Standard
Standard(src: Parcel)
Constructor called from TextUtils
to restore the span from a parcel
Parameters | |
---|---|
src |
Parcel: This value cannot be null . |
Standard
Standard(height: Int)
Set the line height of the paragraph to height
physical pixels.
Parameters | |
---|---|
height |
Int: The units of this value are pixels. Value is 1 or greater |
Public methods
chooseHeight
open fun chooseHeight(
text: CharSequence,
start: Int,
end: Int,
spanstartv: Int,
lineHeight: Int,
fm: Paint.FontMetricsInt
): Unit
Classes that implement this should define how the height is being calculated.
Parameters | |
---|---|
text |
CharSequence: This value cannot be null . |
start |
Int: the start of the line |
end |
Int: the end of the line |
spanstartv |
Int: the start of the span |
lineHeight |
Int: the line height |
fm |
Paint.FontMetricsInt: This value cannot be null . |
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 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getHeight
open fun getHeight(): Int
Returns the line height specified by this span.
The units of this value are pixels.
Return | |
---|---|
Int |
The units of this value are pixels. {} |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. 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 android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |