Added in API level 17

LocaleSpan


open class LocaleSpan : MetricAffectingSpan, ParcelableSpan
kotlin.Any
   ↳ android.text.style.CharacterStyle
   ↳ android.text.style.MetricAffectingSpan
   ↳ android.text.style.LocaleSpan

Changes the Locale of the text to which the span is attached.

Summary

Public constructors

Creates a LocaleSpan from LocaleList.

LocaleSpan(source: Parcel!)

LocaleSpan(locale: Locale?)

Creates a LocaleSpan from a well-formed Locale.

Public methods
open Int

open Locale?

open LocaleList

open Int

open String

open Unit

open Unit

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

Inherited functions

Public constructors

LocaleSpan

Added in API level 24
LocaleSpan(locales: LocaleList)

Creates a LocaleSpan from LocaleList.

Parameters
locales LocaleList: The LocaleList of the text to which the span is attached. This value cannot be null.
Exceptions
java.lang.NullPointerException if locales is null

LocaleSpan

Added in API level 17
LocaleSpan(source: Parcel!)

LocaleSpan

Added in API level 17
LocaleSpan(locale: Locale?)

Creates a LocaleSpan from a well-formed Locale. Note that only Locale objects that can be created by Locale.forLanguageTag(String) are supported.

Caveat: Do not specify any Locale object that cannot be created by Locale.forLanguageTag(String). new Locale(" a ", " b c", " d") is an example of such a malformed Locale object.

Parameters
locale Locale?: The Locale of the text to which the span is attached. This value may be null.

Public methods

describeContents

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

getLocale

Added in API level 17
open fun getLocale(): Locale?
Return
Locale? The Locale for this span. If multiple locales are associated with this span, only the first locale is returned. null if no Locale is specified.

getLocales

Added in API level 24
open fun getLocales(): LocaleList
Return
LocaleList The entire list of locales that are associated with this span. This value cannot be null.

getSpanTypeId

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

toString

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

updateDrawState

Added in API level 17
open fun updateDrawState(ds: TextPaint!): Unit

updateMeasureState

Added in API level 17
open fun updateMeasureState(paint: TextPaint): Unit
Parameters
textPaint the paint used for drawing the text This value cannot be null.

writeToParcel

Added in API level 17
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. 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