public class TextAppearanceSpan
extends MetricAffectingSpan implements ParcelableSpan
| java.lang.Object | |||
| ↳ | android.text.style.CharacterStyle | ||
| ↳ | android.text.style.MetricAffectingSpan | ||
| ↳ | android.text.style.TextAppearanceSpan | ||
设置文本颜色,大小,样式和字体以匹配TextAppearance资源。
Inherited constants |
|---|
android.os.Parcelable
|
Public constructors |
|
|---|---|
TextAppearanceSpan(Context context, int appearance) 使用指定的TextAppearance资源来确定文本外观。 |
|
TextAppearanceSpan(Context context, int appearance, int colorList) 使用指定的TextAppearance资源来确定文本外观,并使用指定的文本颜色资源来确定颜色。 |
|
TextAppearanceSpan(String family, int style, int size, ColorStateList color, ColorStateList linkColor) 使用指定的字体,大小,样式和颜色绘制文本。 |
|
TextAppearanceSpan(Parcel src) |
|
Public methods |
|
|---|---|
int |
describeContents() 描述此Parcelable实例的封送表示中包含的特殊对象的种类。 |
String |
getFamily() 返回由此跨度指定的字体系列,如果未指定,则返回 |
ColorStateList |
getLinkTextColor() 返回此跨度指定的链接颜色,如果未指定,则返回 |
int |
getSpanTypeId() 返回此跨度类的特殊类型标识符。 |
ColorStateList |
getTextColor() 返回此跨度指定的文本颜色,如果未指定,则返回 |
int |
getTextSize() 返回由此跨度指定的文本大小,如果未指定,则返回 |
int |
getTextStyle() 返回由此跨度指定的文本样式,如果未指定,则返回 |
void |
updateDrawState(TextPaint ds) |
void |
updateMeasureState(TextPaint ds) |
void |
writeToParcel(Parcel dest, int flags) 将此对象平铺到一个包裹中。 |
Inherited methods |
|
|---|---|
android.text.style.MetricAffectingSpan
|
|
android.text.style.CharacterStyle
|
|
java.lang.Object
|
|
android.text.ParcelableSpan
|
|
android.os.Parcelable
|
|
TextAppearanceSpan (Context context, int appearance)
使用指定的TextAppearance资源来确定文本外观。 appearance应该是,例如, android.R.style.TextAppearance_Small 。
| Parameters | |
|---|---|
context |
Context
|
appearance |
int
|
TextAppearanceSpan (Context context, int appearance, int colorList)
使用指定的TextAppearance资源来确定文本外观,并使用指定的文本颜色资源来确定颜色。 例如, appearance应该是android.R.style.TextAppearance_Small ,而colorList应该是,例如android.R.styleable.Theme_textColorPrimary 。
| Parameters | |
|---|---|
context |
Context
|
appearance |
int
|
colorList |
int
|
TextAppearanceSpan (String family, int style, int size, ColorStateList color, ColorStateList linkColor)
使用指定的字体,大小,样式和颜色绘制文本。
| Parameters | |
|---|---|
family |
String
|
style |
int
|
size |
int
|
color |
ColorStateList
|
linkColor |
ColorStateList
|
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. |
ColorStateList getLinkTextColor ()
返回此跨度指定的链接颜色,如果未指定,则返回 null 。
| Returns | |
|---|---|
ColorStateList |
|
ColorStateList getTextColor ()
返回此跨度指定的文本颜色,如果未指定,则返回 null 。
| Returns | |
|---|---|
ColorStateList |
|
void updateMeasureState (TextPaint ds)
| Parameters | |
|---|---|
ds |
TextPaint
|
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. |