# Print output for @column tags ?>
public
class
TextAppearanceSpan
extends MetricAffectingSpan
implements
ParcelableSpan
java.lang.Object | |||
↳ | android.text.style.CharacterStyle | ||
↳ | android.text.style.MetricAffectingSpan | ||
↳ | android.text.style.TextAppearanceSpan |
Sets the text appearance using the given
TextAppearance
attributes.
By default TextAppearanceSpan
only changes the specified attributes in XML.
textColorHighlight
,
textColorHint
,
textAllCaps
and
fallbackLineSpacing
are not supported by TextAppearanceSpan
.
See also:
XML attributes | ||
---|---|---|
android:elegantTextHeight |
Elegant text height, especially for less compacted complex script text. | |
android:fontFamily |
Font family (named by string or as a font resource reference) for the text. | |
android:fontFeatureSettings |
Font feature settings. | |
android:fontVariationSettings |
Font variation settings. | |
android:letterSpacing |
Text letter-spacing. | |
android:shadowColor |
Place a blurred shadow of text underneath the text, drawn with the specified color. | |
android:shadowDx |
Horizontal offset of the text shadow. | |
android:shadowDy |
Vertical offset of the text shadow. | |
android:shadowRadius |
Blur radius of the text shadow. | |
android:textColor |
Text color. | |
android:textColorLink |
Color of the links. | |
android:textFontWeight |
Weight for the font used in the TextView. | |
android:textSize |
Size of the text. | |
android:textStyle |
Style (normal, bold, italic, bold|italic) for the text. | |
android:typeface |
Typeface (normal, sans, serif, monospace) for the text. |
Inherited constants |
---|
Public constructors | |
---|---|
TextAppearanceSpan(Context context, int appearance)
Uses the specified TextAppearance resource to determine the text appearance. |
|
TextAppearanceSpan(Context context, int appearance, int colorList)
Uses the specified TextAppearance resource to determine the text appearance, and the specified text color resource to determine the color. |
|
TextAppearanceSpan(String family, int style, int size, ColorStateList color, ColorStateList linkColor)
Makes text be drawn with the specified typeface, size, style, and colors. |
|
TextAppearanceSpan(Parcel src)
|
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
String
|
getFamily()
Returns the typeface family specified by this span, or |
String
|
getFontFeatureSettings()
Returns the font feature settings specified by this span, or |
String
|
getFontVariationSettings()
Returns the font variation settings specified by this span, or |
ColorStateList
|
getLinkTextColor()
Returns the link color specified by this span, or |
int
|
getShadowColor()
Returns the color of the text shadow specified by this span, or |
float
|
getShadowDx()
Returns the horizontal offset of the text shadow specified by this span, or |
float
|
getShadowDy()
Returns the vertical offset of the text shadow specified by this span, or |
float
|
getShadowRadius()
Returns the blur radius of the text shadow specified by this span, or |
int
|
getSpanTypeId()
Return a special type identifier for this span class. |
ColorStateList
|
getTextColor()
Returns the text color specified by this span, or |
int
|
getTextFontWeight()
Returns the text font weight specified by this span, or |
LocaleList
|
getTextLocales()
Returns the |
int
|
getTextSize()
Returns the text size specified by this span, or |
int
|
getTextStyle()
Returns the text style specified by this span, or |
Typeface
|
getTypeface()
Returns the typeface specified by this span, or |
boolean
|
isElegantTextHeight()
Returns the value of elegant height metrics flag specified by this span,
or |
void
|
updateDrawState(TextPaint ds)
|
void
|
updateMeasureState(TextPaint ds)
Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Elegant text height, especially for less compacted complex script text.
May be a boolean value, such as "true
" or
"false
".
Font family (named by string or as a font resource reference) for the text.
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
Font feature settings.
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
Font variation settings.
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
Text letter-spacing.
May be a floating point value, such as "1.2
".
Place a blurred shadow of text underneath the text, drawn with the
specified color. The text shadow produced does not interact with
properties on View that are responsible for real time shadows,
elevation
and
translationZ
.
May be a color value, in the form of "#rgb
",
"#argb
", "#rrggbb
", or
"#aarrggbb
".
Horizontal offset of the text shadow.
May be a floating point value, such as "1.2
".
Vertical offset of the text shadow.
May be a floating point value, such as "1.2
".
Blur radius of the text shadow.
May be a floating point value, such as "1.2
".
Text color.
May be a reference to another resource, in the form
"@[+][package:]type/name
" or a theme
attribute in the form
"?[package:]type/name
".
May be a color value, in the form of "#rgb
",
"#argb
", "#rrggbb
", or
"#aarrggbb
".
Color of the links.
May be a reference to another resource, in the form
"@[+][package:]type/name
" or a theme
attribute in the form
"?[package:]type/name
".
May be a color value, in the form of "#rgb
",
"#argb
", "#rrggbb
", or
"#aarrggbb
".
Weight for the font used in the TextView.
May be an integer value, such as "100
".
Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp).
May be a dimension value, which is a floating point number appended with a
unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels),
sp (scaled pixels based on preferred font size), in (inches), and
mm (millimeters).
Style (normal, bold, italic, bold|italic) for the text.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
bold | 1 | |
italic | 2 | |
normal | 0 |
Typeface (normal, sans, serif, monospace) for the text.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
monospace | 3 | |
normal | 0 | |
sans | 1 | |
serif | 2 |
public TextAppearanceSpan (Context context, int appearance)
Uses the specified TextAppearance resource to determine the
text appearance. The appearance
should be, for example,
android.R.style.TextAppearance_Small
.
Parameters | |
---|---|
context |
Context |
appearance |
int |
public TextAppearanceSpan (Context context, int appearance, int colorList)
Uses the specified TextAppearance resource to determine the
text appearance, and the specified text color resource
to determine the color. The appearance
should be,
for example, android.R.style.TextAppearance_Small
,
and the colorList
should be, for example,
android.R.styleable.Theme_textColorPrimary
.
Parameters | |
---|---|
context |
Context |
appearance |
int |
colorList |
int |
public TextAppearanceSpan (String family, int style, int size, ColorStateList color, ColorStateList linkColor)
Makes text be drawn with the specified typeface, size, style, and colors.
Parameters | |
---|---|
family |
String |
style |
int |
size |
int |
color |
ColorStateList |
linkColor |
ColorStateList |
public int describeContents ()
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.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public String getFamily ()
Returns the typeface family specified by this span, or null
if it does not specify one.
Returns | |
---|---|
String |
public String getFontFeatureSettings ()
Returns the font feature settings specified by this span, or null
if it does not specify one.
Returns | |
---|---|
String |
public String getFontVariationSettings ()
Returns the font variation settings specified by this span, or null
if it does not specify one.
Returns | |
---|---|
String |
public ColorStateList getLinkTextColor ()
Returns the link color specified by this span, or null
if it does not specify one.
Returns | |
---|---|
ColorStateList |
public int getShadowColor ()
Returns the color of the text shadow specified by this span, or 0
if it does not specify one.
Returns | |
---|---|
int |
public float getShadowDx ()
Returns the horizontal offset of the text shadow specified by this span, or 0.0f
if it does not specify one.
Returns | |
---|---|
float |
public float getShadowDy ()
Returns the vertical offset of the text shadow specified by this span, or 0.0f
if it does not specify one.
Returns | |
---|---|
float |
public float getShadowRadius ()
Returns the blur radius of the text shadow specified by this span, or 0.0f
if it does not specify one.
Returns | |
---|---|
float |
public int getSpanTypeId ()
Return a special type identifier for this span class.
Returns | |
---|---|
int |
public ColorStateList getTextColor ()
Returns the text color specified by this span, or null
if it does not specify one.
Returns | |
---|---|
ColorStateList |
public int getTextFontWeight ()
Returns the text font weight specified by this span, or -1
if it does not specify one.
Returns | |
---|---|
int |
public LocaleList getTextLocales ()
Returns the LocaleList
specified by this span, or null
if it does not specify one.
Returns | |
---|---|
LocaleList |
public int getTextSize ()
Returns the text size specified by this span, or -1
if it does not specify one.
Returns | |
---|---|
int |
public int getTextStyle ()
Returns the text style specified by this span, or 0
if it does not specify one.
Returns | |
---|---|
int |
public Typeface getTypeface ()
Returns the typeface specified by this span, or null
if it does not specify one.
Returns | |
---|---|
Typeface |
public boolean isElegantTextHeight ()
Returns the value of elegant height metrics flag specified by this span,
or false
if it does not specify one.
Returns | |
---|---|
boolean |
public void updateMeasureState (TextPaint ds)
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 | |
---|---|
ds |
TextPaint : the paint used for drawing the text
This value cannot be null . |
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
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.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |