MaterialResources

public class MaterialResources
extends Object

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


Utility methods to resolve resources for components.

Summary

Public methods

static ColorStateList getColorStateList(Context context, TypedArray attributes, int index)

Returns the ColorStateList from the given attributes.

static Drawable getDrawable(Context context, TypedArray attributes, int index)

Returns the drawable object from the given attributes.

static TextAppearance getTextAppearance(Context context, TypedArray attributes, int index)

Returns a TextAppearanceSpan object from the given attributes.

Inherited methods

From class java.lang.Object

Public methods

getColorStateList

ColorStateList getColorStateList (Context context, 
                TypedArray attributes, 
                int index)

Returns the ColorStateList from the given attributes. The resource can include themeable attributes, regardless of API level.

Parameters
context Context

attributes TypedArray

index int

Returns
ColorStateList

getDrawable

Drawable getDrawable (Context context, 
                TypedArray attributes, 
                int index)

Returns the drawable object from the given attributes.

This method supports inflation of <vector> and <animated-vector> resources on devices where platform support is not available.

Parameters
context Context

attributes TypedArray

index int

Returns
Drawable

getTextAppearance

TextAppearance getTextAppearance (Context context, 
                TypedArray attributes, 
                int index)

Returns a TextAppearanceSpan object from the given attributes.

You only need this if you are drawing text manually. Normally, TextView takes care of this.

Parameters
context Context

attributes TypedArray

index int

Returns
TextAppearance