AppCompatResources

class AppCompatResources


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

Summary

Public functions

java-static ColorStateList!
getColorStateList(context: Context, resId: @ColorRes Int)

Returns the ColorStateList from the given resource.

java-static Drawable?
getDrawable(context: Context, resId: @DrawableRes Int)

Return a drawable object associated with a particular resource ID.

Public functions

getColorStateList

Added in 1.1.0
java-static fun getColorStateList(context: Context, resId: @ColorRes Int): ColorStateList!

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

Parameters
context: Context

context to inflate against

resId: @ColorRes Int

the resource identifier of the ColorStateList to retrieve

getDrawable

Added in 1.1.0
java-static fun getDrawable(context: Context, resId: @DrawableRes Int): Drawable?

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
context: Context

context to inflate against

resId: @DrawableRes Int

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
Drawable?

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

See also
getDrawable