TextAppearanceSpan
open class TextAppearanceSpan : MetricAffectingSpan, ParcelableSpan
kotlin.Any | |||
↳ | 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 android.widget.TextView#setTextAppearance(int)}
Summary
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. |
Public constructors | |
---|---|
TextAppearanceSpan(context: Context!, appearance: Int) Uses the specified TextAppearance resource to determine the text appearance. |
|
TextAppearanceSpan(context: Context!, appearance: Int, colorList: Int) Uses the specified TextAppearance resource to determine the text appearance, and the specified text color resource to determine the color. |
|
TextAppearanceSpan(family: String!, style: Int, size: Int, color: ColorStateList!, linkColor: ColorStateList!) Makes text be drawn with the specified typeface, size, style, and colors. |
|
TextAppearanceSpan(src: Parcel!) |
Public methods | |
---|---|
open Int | |
open String! |
Returns the typeface family specified by this span, or |
open String? |
Returns the font feature settings specified by this span, or |
open String? |
Returns the font variation settings specified by this span, or |
open Float |
Returns the value of letter spacing to be added in em unit. |
open ColorStateList! |
Returns the link color specified by this span, or |
open Int |
Returns the color of the text shadow specified by this span, or |
open Float |
Returns the horizontal offset of the text shadow specified by this span, or |
open Float |
Returns the vertical offset of the text shadow specified by this span, or |
open Float |
Returns the blur radius of the text shadow specified by this span, or |
open Int | |
open ColorStateList! |
Returns the text color specified by this span, or |
open Int |
Returns the text font weight specified by this span, or |
open LocaleList? |
Returns the |
open Int |
Returns the text size specified by this span, or |
open Int |
Returns the text style specified by this span, or |
open Typeface? |
Returns the typeface specified by this span, or |
open Boolean |
Returns the value of elegant height metrics flag specified by this span, or |
open String |
toString() |
open Unit |
updateDrawState(ds: TextPaint!) |
open Unit | |
open Unit |
writeToParcel(dest: Parcel, flags: Int) |
Inherited functions | |
---|---|
XML attributes
android:elegantTextHeight
android:elegantTextHeight
May be a boolean value, such as "true
" or "false
".
android:fontFamily
android:fontFamily
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:fontFeatureSettings
android:fontFeatureSettings
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:fontVariationSettings
android:fontVariationSettings
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:letterSpacing
android:letterSpacing
May be a floating point value, such as "1.2
".
android:shadowColor
android:shadowColor
elevation
and translationZ
.
May be a color value, in the form of "rgb
", "argb
", "rrggbb
", or "aarrggbb
".
android:shadowDx
android:shadowDx
May be a floating point value, such as "1.2
".
android:shadowDy
android:shadowDy
May be a floating point value, such as "1.2
".
android:shadowRadius
android:shadowRadius
May be a floating point value, such as "1.2
".
android:textColor
android:textColor
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
".
android:textColorLink
android:textColorLink
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
".
android:textFontWeight
android:textFontWeight
May be an integer value, such as "100
".
android:textSize
android:textSize
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).
android:textStyle
android:textStyle
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
bold | 1 | |
italic | 2 | |
normal | 0 |
android:typeface
android:typeface
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
monospace | 3 | |
normal | 0 | |
sans | 1 | |
serif | 2 |
Public constructors
TextAppearanceSpan
TextAppearanceSpan(
context: Context!,
appearance: Int)
Uses the specified TextAppearance resource to determine the text appearance. The appearance
should be, for example, android.R.style.TextAppearance_Small
.
TextAppearanceSpan
TextAppearanceSpan(
context: Context!,
appearance: Int,
colorList: Int)
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
.
TextAppearanceSpan
TextAppearanceSpan(
family: String!,
style: Int,
size: Int,
color: ColorStateList!,
linkColor: ColorStateList!)
Makes text be drawn with the specified typeface, size, style, and colors.
Public methods
describeContents
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 |
getFamily
open fun getFamily(): String!
Returns the typeface family specified by this span, or null
if it does not specify one.
getFontFeatureSettings
open fun getFontFeatureSettings(): String?
Returns the font feature settings specified by this span, or null
if it does not specify one.
getFontVariationSettings
open fun getFontVariationSettings(): String?
Returns the font variation settings specified by this span, or null
if it does not specify one.
getLetterSpacing
open fun getLetterSpacing(): Float
Returns the value of letter spacing to be added in em unit.
Return | |
---|---|
Float |
a letter spacing amount |
getLinkTextColor
open fun getLinkTextColor(): ColorStateList!
Returns the link color specified by this span, or null
if it does not specify one.
getShadowColor
open fun getShadowColor(): Int
Returns the color of the text shadow specified by this span, or 0
if it does not specify one.
getShadowDx
open fun getShadowDx(): Float
Returns the horizontal offset of the text shadow specified by this span, or 0.0f
if it does not specify one.
getShadowDy
open fun getShadowDy(): Float
Returns the vertical offset of the text shadow specified by this span, or 0.0f
if it does not specify one.
getShadowRadius
open fun getShadowRadius(): Float
Returns the blur radius of the text shadow specified by this span, or 0.0f
if it does not specify one.
getTextColor
open fun getTextColor(): ColorStateList!
Returns the text color specified by this span, or null
if it does not specify one.
getTextFontWeight
open fun getTextFontWeight(): Int
Returns the text font weight specified by this span, or FontStyle.FONT_WEIGHT_UNSPECIFIED
if it does not specify one.
getTextLocales
open fun getTextLocales(): LocaleList?
Returns the android.os.LocaleList
specified by this span, or null
if it does not specify one.
getTextSize
open fun getTextSize(): Int
Returns the text size specified by this span, or -1
if it does not specify one.
getTextStyle
open fun getTextStyle(): Int
Returns the text style specified by this span, or 0
if it does not specify one.
getTypeface
open fun getTypeface(): Typeface?
Returns the typeface specified by this span, or null
if it does not specify one.
isElegantTextHeight
open fun isElegantTextHeight(): Boolean
Returns the value of elegant height metrics flag specified by this span, or false
if it does not specify one.
toString
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
updateMeasureState
open fun updateMeasureState(ds: TextPaint): Unit
Parameters | |
---|---|
textPaint |
the paint used for drawing the text This value cannot be null . |
writeToParcel
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 |