TextAppearance

public class TextAppearance
extends Object

java.lang.Object
   ↳ com.google.android.material.resources.TextAppearance


Utility class that contains the data from parsing a TextAppearance style resource.

Summary

Fields

public final String fontFamily

public final ColorStateList shadowColor

public final float shadowDx

public final float shadowDy

public final float shadowRadius

public final boolean textAllCaps

public final ColorStateList textColor

public final ColorStateList textColorHint

public final ColorStateList textColorLink

public final float textSize

public final int textStyle

public final int typeface

Public constructors

TextAppearance(Context context, int id)

Parses the given TextAppearance style resource.

Public methods

Typeface getFont(Context context)

Returns the font Typeface resolved from the fontFamily, style, and typeface.

void updateDrawState(Context context, TextPaint textPaint)

Applies the attributes that affect drawing from TextAppearance to the given TextPaint.

void updateMeasureState(Context context, TextPaint textPaint)

Applies the attributes that affect measurement from TextAppearance to the given TextPaint.

Inherited methods

From class java.lang.Object

Fields

fontFamily

String fontFamily

shadowColor

ColorStateList shadowColor

shadowDx

float shadowDx

shadowDy

float shadowDy

shadowRadius

float shadowRadius

textAllCaps

boolean textAllCaps

textColor

ColorStateList textColor

textColorHint

ColorStateList textColorHint

textColorLink

ColorStateList textColorLink

textSize

float textSize

textStyle

int textStyle

typeface

int typeface

Public constructors

TextAppearance

TextAppearance (Context context, 
                int id)

Parses the given TextAppearance style resource.

Parameters
context Context

id int

Public methods

getFont

Typeface getFont (Context context)

Returns the font Typeface resolved from the fontFamily, style, and typeface.

Parameters
context Context

Returns
Typeface

updateDrawState

void updateDrawState (Context context, 
                TextPaint textPaint)

Applies the attributes that affect drawing from TextAppearance to the given TextPaint. Note that not all attributes can be applied to the TextPaint.

Parameters
context Context

textPaint TextPaint

updateMeasureState

void updateMeasureState (Context context, 
                TextPaint textPaint)

Applies the attributes that affect measurement from TextAppearance to the given TextPaint. Note that not all attributes can be applied to the TextPaint.

Parameters
context Context

textPaint TextPaint