Added in API level 1

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

Constructs a Standard from a parcel.

Constructs a Standard from an alignment.

Public methods
open Int

open Layout.Alignment!

open Int

open String

open Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Public constructors

Standard

Added in API level 3
Standard(src: Parcel)

Constructs a Standard from a parcel.

Parameters
src Parcel: This value cannot be null.

Standard

Added in API level 1
Standard(align: Layout.Alignment)

Constructs a Standard from an alignment.

Parameters
align Layout.Alignment: This value cannot be null.

Public methods

describeContents

Added in API level 3
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

Added in API level 1
open fun getAlignment(): Layout.Alignment!
Return
Layout.Alignment! the text alignment

getSpanTypeId

Added in API level 3
open fun getSpanTypeId(): Int

toString

Added in API level 1
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 3
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