Standard
open class Standard : AlignmentSpan, ParcelableSpan
kotlin.Any | |
↳ | android.text.style.AlignmentSpan.Standard |
Default implementation of the AlignmentSpan
.
For example, a text written in a left to right language, like English, which is by default aligned to the left, can be aligned opposite to the layout direction like this:
<code>SpannableString string = new SpannableString("Text with opposite alignment"); string.setSpan(new AlignmentSpan.Standard(Layout.Alignment.ALIGN_OPPOSITE), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>Align left to right text opposite to the layout direction.
A text written in a right to left language, like Hebrew, which is by default aligned to the right, can be aligned opposite to the layout direction like this:
<code>SpannableString string = new SpannableString("טקסט עם יישור הפוך"); string.setSpan(new AlignmentSpan.Standard(Layout.Alignment.ALIGN_OPPOSITE), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>Align right to left text opposite to the layout direction.
Summary
Public constructors | |
---|---|
Standard(align: Layout.Alignment) Constructs a |
|
Constructs a |
Public methods | |
---|---|
open Int | |
open Layout.Alignment! | |
open Int | |
open String |
toString() |
open Unit |
writeToParcel(dest: Parcel, flags: Int) Flatten this object in to a Parcel. |
Public constructors
Standard
Standard(align: Layout.Alignment)
Constructs a Standard
from an alignment.
Parameters | |
---|---|
align |
Layout.Alignment: This value cannot be null . |
Standard
Standard(src: Parcel)
Constructs a Standard
from a parcel.
Parameters | |
---|---|
src |
Parcel: This value cannot be null . |
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 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getAlignment
open fun getAlignment(): Layout.Alignment!
Return | |
---|---|
Layout.Alignment! |
the text alignment |
toString
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
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 either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |