Added in API level 1

Resources.Theme


public final class Resources.Theme
extends Object

java.lang.Object
   ↳ android.content.res.Resources.Theme


This class holds the current attribute values for a particular theme. In other words, a Theme is a set of values for resource attributes; these are used in conjunction with TypedArray to resolve the final value for an attribute.

The Theme's attributes come into play in two ways: (1) a styled attribute can explicit reference a value in the theme through the "?themeAttribute" syntax; (2) if no value has been defined for a particular styled attribute, as a last resort we will try to find that attribute's value in the Theme.

You will normally use the obtainStyledAttributes(AttributeSet, int, int, int) APIs to retrieve XML attributes with style and theme information applied.

Summary

Public methods

void applyStyle(int resId, boolean force)

Place new attribute values into the theme.

void dump(int priority, String tag, String prefix)

Print contents of this theme out to the log.

boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

int[] getAttributeResolutionStack(int defStyleAttr, int defStyleRes, int explicitStyleRes)

Returns the ordered list of resource ID that are considered when resolving attribute values when making an equivalent call to obtainStyledAttributes(AttributeSet,int[],int,int) .

int getChangingConfigurations()

Returns a bit mask of configuration changes that will impact this theme (and thus require completely reloading it).

Drawable getDrawable(int id)

Return a drawable object associated with a particular resource ID and styled for the Theme.

int getExplicitStyle(AttributeSet set)

Returns the resource ID for the style specified using style="..." in the AttributeSet's backing XML element or Resources.ID_NULL otherwise if not specified or otherwise not applicable.

Resources getResources()

Returns the resources to which this theme belongs.

int hashCode()

Returns a hash code value for the object.

TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes)

Return a TypedArray holding the attribute values in set that are listed in attrs.

TypedArray obtainStyledAttributes(int[] attrs)

Return a TypedArray holding the values defined by Theme which are listed in attrs.

TypedArray obtainStyledAttributes(int resId, int[] attrs)

Return a TypedArray holding the values defined by the style resource resid which are listed in attrs.

void rebase()

Rebases the theme against the parent Resource object's current configuration by re-applying the styles passed to applyStyle(int, boolean).

boolean resolveAttribute(int resid, TypedValue outValue, boolean resolveRefs)

Retrieve the value of an attribute in the Theme.

void setTo(Resources.Theme other)

Set this theme to hold the same contents as the theme other.

String toString()

Returns a string representation of the object.

Inherited methods