Most visited

Recently visited

Added in API level 17

LocaleSpan

public class LocaleSpan
extends MetricAffectingSpan implements ParcelableSpan

java.lang.Object
   ↳ android.text.style.CharacterStyle
     ↳ android.text.style.MetricAffectingSpan
       ↳ android.text.style.LocaleSpan


更改跨度所附文本的 Locale

Summary

Inherited constants

From interface android.os.Parcelable

Public constructors

LocaleSpan(Locale locale)

创建 LocaleSpan从井中形成 Locale

LocaleSpan(LocaleList locales)

创建 LocaleSpanLocaleList

LocaleSpan(Parcel source)

Public methods

int describeContents()

描述此Parcelable实例的封送表示中包含的特殊对象的种类。

Locale getLocale()
LocaleList getLocales()
int getSpanTypeId()

返回此跨度类的特殊类型标识符。

void updateDrawState(TextPaint ds)
void updateMeasureState(TextPaint paint)
void writeToParcel(Parcel dest, int flags)

将此对象平铺到一个包裹中。

Inherited methods

From class android.text.style.MetricAffectingSpan
From class android.text.style.CharacterStyle
From class java.lang.Object
From interface android.text.ParcelableSpan
From interface android.os.Parcelable

Public constructors

LocaleSpan

Added in API level 17
LocaleSpan (Locale locale)

创建LocaleSpan从井中形成Locale 请注意,只有Locale可以通过以下方式创建对象forLanguageTag(String)的支持。

警告:不要指定任何Locale不能由创建对象forLanguageTag(String) new Locale(" a ", " b c", " d")是这种格式不正确的Locale对象的示例。

Parameters
locale Locale: The Locale of the text to which the span is attached.

也可以看看:

LocaleSpan

Added in API level 24
LocaleSpan (LocaleList locales)

创建 LocaleSpanLocaleList

Parameters
locales LocaleList: The LocaleList of the text to which the span is attached.
Throws
NullPointerException if locales is null

LocaleSpan

Added in API level 17
LocaleSpan (Parcel source)

Parameters
source Parcel

Public methods

describeContents

Added in API level 17
int describeContents ()

描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象在writeToParcel(Parcel, int)的输出中包含writeToParcel(Parcel, int) ,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR位。

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getLocale

Added in API level 17
Locale getLocale ()

Returns
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
LocaleList getLocales ()

Returns
LocaleList The entire list of locales that are associated with this span.

getSpanTypeId

Added in API level 17
int getSpanTypeId ()

Return a special type identifier for this span class.

Returns
int

updateDrawState

Added in API level 17
void updateDrawState (TextPaint ds)

Parameters
ds TextPaint

updateMeasureState

Added in API level 17
void updateMeasureState (TextPaint paint)

Parameters
paint TextPaint

writeToParcel

Added in API level 17
void writeToParcel (Parcel dest, 
                int flags)

将此对象平铺到一个包裹中。

Parameters
dest Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

Hooray!