Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Standard

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/text/style/AlignmentSpan.Standard "View this page in Java")

```
open class Standard : AlignmentSpan, ParcelableSpan
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.text.style.AlignmentSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#) |

Default implementation of the `https://developer.android.com/reference/kotlin/android/text/style/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:

```kotlin
<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:

```kotlin
<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 ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#Standard(android.os.Parcel)(src: https://developer.android.com/reference/kotlin/android/os/Parcel.html#)` Constructs a `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#` from a parcel. |
| `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#Standard(android.text.Layout.Alignment)(align: https://developer.android.com/reference/kotlin/android/text/Layout.Alignment.html#)` Constructs a `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#` from an alignment. |

| Public methods ||
|---|---|
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#describeContents()()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| open [Layout.Alignment](https://developer.android.com/reference/kotlin/android/text/Layout.Alignment.html#)! | `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#getAlignment()()` Returns the alignment of the text. |
| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#getSpanTypeId()()` Return a special type identifier for this span class. |
| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#toString()()` Returns a string representation of the object. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#writeToParcel(android.os.Parcel,%20kotlin.Int)(dest: https://developer.android.com/reference/kotlin/android/os/Parcel.html#, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Flatten this object in to a Parcel. |

## Public constructors

### Standard

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Standard(src: Parcel)
```

Constructs a `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#` from a parcel.

| Parameters ||
|---|---|
| `src` | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#): This value cannot be `null`. |

### Standard

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Standard(align: Layout.Alignment)
```

Constructs a `https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard#` from an alignment.

| Parameters ||
|---|---|
| `align` | [Layout.Alignment](https://developer.android.com/reference/kotlin/android/text/Layout.Alignment.html#): This value cannot be `null`. |

## Public methods

### describeContents

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
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 `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`, the return value of this method must include the `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` bit.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` |

### getAlignment

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getAlignment(): Layout.Alignment!
```

Returns the alignment of the text.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/text/Layout.Alignment.html#!` | the text alignment |

### getSpanTypeId

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getSpanTypeId(): Int
```

Return a special type identifier for this span class.

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun toString(): String
```

Returns a string representation of the object.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | a string representation of the object. |

### writeToParcel

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

Flatten this object in to a Parcel.

| Parameters ||
|---|---|
| `dest` | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#): This value cannot be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` |