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

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

open Locale?

open LocaleList

open Int

Return a special type identifier for this span class.

open String

Returns a string representation of the object.

open Unit

open Unit

Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.

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

Flatten this object in to a Parcel.

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

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

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

Return a special type identifier for this span class.

toString

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

Returns a string representation of the object.

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

Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.

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

Flatten this object in to a Parcel.

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