AppCompatResources


public final class AppCompatResources


Class for accessing an application's resources through AppCompat, and thus any backward compatible functionality.

Summary

Public methods

static ColorStateList
getColorStateList(@NonNull Context context, @ColorRes int resId)

Returns the ColorStateList from the given resource.

static @Nullable Drawable
getDrawable(@NonNull Context context, @DrawableRes int resId)

Return a drawable object associated with a particular resource ID.

Public methods

getColorStateList

Added in 1.1.0
public static ColorStateList getColorStateList(@NonNull Context context, @ColorRes int resId)

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

Parameters
@NonNull Context context

context to inflate against

@ColorRes int resId

the resource identifier of the ColorStateList to retrieve

getDrawable

Added in 1.1.0
public static @Nullable Drawable getDrawable(@NonNull Context context, @DrawableRes int resId)

Return a drawable object associated with a particular resource ID.

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

Parameters
@NonNull Context context

context to inflate against

@DrawableRes int resId

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns
@Nullable Drawable

Drawable An object that can be used to draw this resource.

See also
getDrawable