# ParcelableSpan

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

# ParcelableSpan

*** ** * ** ***

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

```
interface ParcelableSpan : Parcelable
```

|------------------------------------------------------------------------------------------------------------|
| [android.text.ParcelableSpan](https://developer.android.com/reference/kotlin/android/text/ParcelableSpan#) |

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [AbsoluteSizeSpan](https://developer.android.com/reference/kotlin/android/text/style/AbsoluteSizeSpan),[AlignmentSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard),[Annotation](https://developer.android.com/reference/kotlin/android/text/Annotation),[BackgroundColorSpan](https://developer.android.com/reference/kotlin/android/text/style/BackgroundColorSpan),[BulletSpan](https://developer.android.com/reference/kotlin/android/text/style/BulletSpan),[EasyEditSpan](https://developer.android.com/reference/kotlin/android/text/style/EasyEditSpan),[ForegroundColorSpan](https://developer.android.com/reference/kotlin/android/text/style/ForegroundColorSpan),[LeadingMarginSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan.Standard),[LineBackgroundSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LineBackgroundSpan.Standard),[LineBreakConfigSpan](https://developer.android.com/reference/kotlin/android/text/style/LineBreakConfigSpan),[LineHeightSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LineHeightSpan.Standard),[LocaleSpan](https://developer.android.com/reference/kotlin/android/text/style/LocaleSpan), and 15 others. |------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AbsoluteSizeSpan](https://developer.android.com/reference/kotlin/android/text/style/AbsoluteSizeSpan)                       | A span that changes the size of the text it's attached to.                                                                                                                                                              | | [AlignmentSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan.Standard)           | Default implementation of the[AlignmentSpan](https://developer.android.com/reference/kotlin/android/text/style/AlignmentSpan).                                                                                          | | [Annotation](https://developer.android.com/reference/kotlin/android/text/Annotation)                                         | Annotations are simple key-value pairs that are preserved across TextView save/restore cycles and can be used to keep application-specific data that needs to be maintained for regions of text.                        | | [BackgroundColorSpan](https://developer.android.com/reference/kotlin/android/text/style/BackgroundColorSpan)                 | Changes the background color of the text to which the span is attached.                                                                                                                                                 | | [BulletSpan](https://developer.android.com/reference/kotlin/android/text/style/BulletSpan)                                   | A span which styles paragraphs as bullet points (respecting layout direction).                                                                                                                                          | | [EasyEditSpan](https://developer.android.com/reference/kotlin/android/text/style/EasyEditSpan)                               | Provides an easy way to edit a portion of text.                                                                                                                                                                         | | [ForegroundColorSpan](https://developer.android.com/reference/kotlin/android/text/style/ForegroundColorSpan)                 | Changes the color of the text to which the span is attached.                                                                                                                                                            | | [LeadingMarginSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan.Standard)   | The standard implementation of LeadingMarginSpan, which adjusts the margin but does not do any rendering.                                                                                                               | | [LineBackgroundSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LineBackgroundSpan.Standard) | Default implementation of the[LineBackgroundSpan](https://developer.android.com/reference/kotlin/android/text/style/LineBackgroundSpan), which changes the background color of the lines to which the span is attached. | | [LineBreakConfigSpan](https://developer.android.com/reference/kotlin/android/text/style/LineBreakConfigSpan)                 | LineBreakSpan for changing line break style of the specific region of the text.                                                                                                                                         | | [LineHeightSpan.Standard](https://developer.android.com/reference/kotlin/android/text/style/LineHeightSpan.Standard)         | Default implementation of the[LineHeightSpan](https://developer.android.com/reference/kotlin/android/text/style/LineHeightSpan), which changes the line height of the attached paragraph.                               | | [LocaleSpan](https://developer.android.com/reference/kotlin/android/text/style/LocaleSpan)                                   | Changes the[Locale](https://developer.android.com/reference/kotlin/java/util/Locale.html#)of the text to which the span is attached.                                                                                    | | [NoWritingToolsSpan](https://developer.android.com/reference/kotlin/android/text/style/NoWritingToolsSpan)                   | A span that signals to IMEs that writing tools should not modify the text.                                                                                                                                              | | [QuoteSpan](https://developer.android.com/reference/kotlin/android/text/style/QuoteSpan)                                     | A span which styles paragraphs by adding a vertical stripe at the beginning of the text (respecting layout direction).                                                                                                  | | [RelativeSizeSpan](https://developer.android.com/reference/kotlin/android/text/style/RelativeSizeSpan)                       | Uniformly scales the size of the text to which it's attached by a certain proportion.                                                                                                                                   | | [ScaleXSpan](https://developer.android.com/reference/kotlin/android/text/style/ScaleXSpan)                                   | Scales horizontally the size of the text to which it's attached by a certain factor.                                                                                                                                    | | [StrikethroughSpan](https://developer.android.com/reference/kotlin/android/text/style/StrikethroughSpan)                     | A span that strikes through the text it's attached to.                                                                                                                                                                  | | [StyleSpan](https://developer.android.com/reference/kotlin/android/text/style/StyleSpan)                                     | Span that allows setting the style of the text it's attached to.                                                                                                                                                        | | [SubscriptSpan](https://developer.android.com/reference/kotlin/android/text/style/SubscriptSpan)                             | The span that moves the position of the text baseline lower.                                                                                                                                                            | | [SuggestionRangeSpan](https://developer.android.com/reference/kotlin/android/text/style/SuggestionRangeSpan)                 | A SuggestionRangeSpan is used to show which part of an EditText is affected by a suggestion popup window.                                                                                                               | | [SuggestionSpan](https://developer.android.com/reference/kotlin/android/text/style/SuggestionSpan)                           | Holds suggestion candidates for the text enclosed in this span.                                                                                                                                                         | | [SuperscriptSpan](https://developer.android.com/reference/kotlin/android/text/style/SuperscriptSpan)                         | The span that moves the position of the text baseline higher.                                                                                                                                                           | | [TextAppearanceSpan](https://developer.android.com/reference/kotlin/android/text/style/TextAppearanceSpan)                   | Sets the text appearance using the given[TextAppearance](https://developer.android.com/reference/kotlin/android/R.styleable.html#TextAppearance:kotlin.IntArray)attributes.                                             | | [TtsSpan](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan)                                         | A span that supplies additional meta-data for the associated text intended for text-to-speech engines.                                                                                                                  | | [TypefaceSpan](https://developer.android.com/reference/kotlin/android/text/style/TypefaceSpan)                               | Span that updates the typeface of the text it's attached to.                                                                                                                                                            | | [URLSpan](https://developer.android.com/reference/kotlin/android/text/style/URLSpan)                                         | Implementation of the[ClickableSpan](https://developer.android.com/reference/kotlin/android/text/style/ClickableSpan)that allows setting a url string.                                                                  | | [UnderlineSpan](https://developer.android.com/reference/kotlin/android/text/style/UnderlineSpan)                             | A span that underlines the text it's attached to.                                                                                                                                                                       | |

A special kind of Parcelable for objects that will serve as text spans. This can only be used by code in the framework; it is not intended for applications to implement their own Parcelable spans.

## Summary

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                      Public methods                                                                                                                       ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSpanTypeId](https://developer.android.com/reference/kotlin/android/text/ParcelableSpan#getSpanTypeId())`()` Return a special type identifier for this span class. |

| Inherited functions ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)   | [describeContents](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents())`()` <br /> 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)](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[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int)bit. <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Flatten this object in to a Parcel. <br />                                                                                                                                                                                                                                                                                                     | ||

## Public methods

### getSpanTypeId

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

```
abstract fun getSpanTypeId(): Int
```

Return a special type identifier for this span class.