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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

open Layout.Alignment!

Returns the alignment of the text.

open Int

Return a special type identifier for this span class.

open String

Returns a string representation of the object.

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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getAlignment

Added in API level 1
open fun getAlignment(): Layout.Alignment!

Returns the alignment of the text.

Return
Layout.Alignment! the text alignment

getSpanTypeId

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

Return a special type identifier for this span class.

toString

Added in API level 1
open fun toString(): String

Returns a string representation of the object.

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 the following: