AnimatorInflater


public class AnimatorInflater


This class is used to instantiate animator XML files into Animator objects.

For performance reasons, inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use this inflater with an XmlPullParser over a plain XML file at runtime; it only works with an XmlPullParser returned from a compiled resource (R. something file.)

Summary

Public methods

static @NonNull Animator
loadAnimator(@NonNull Context context, @AnimatorRes int id)

Loads an Animator object from a resource

static @NonNull Animator
loadAnimator(
    @NonNull Resources resources,
    @Nullable Resources.Theme theme,
    @AnimatorRes int id
)

Loads an Animator object from a resource

static @NonNull Interpolator
loadInterpolator(
    @NonNull Context context,
    @AnimatorRes @InterpolatorRes int id
)

Loads an Interpolator object from a resource

Public methods

loadAnimator

public static @NonNull Animator loadAnimator(@NonNull Context context, @AnimatorRes int id)

Loads an Animator object from a resource

Parameters
@NonNull Context context

Application context used to access resources

@AnimatorRes int id

The resource id of the animation to load

Returns
@NonNull Animator

The animator object reference by the specified id

Throws
android.content.res.Resources.NotFoundException

when the animation cannot be loaded

loadAnimator

public static @NonNull Animator loadAnimator(
    @NonNull Resources resources,
    @Nullable Resources.Theme theme,
    @AnimatorRes int id
)

Loads an Animator object from a resource

Parameters
@NonNull Resources resources

The resources

@Nullable Resources.Theme theme

The theme

@AnimatorRes int id

The resource id of the animation to load

Returns
@NonNull Animator

The animator object reference by the specified id

Throws
android.content.res.Resources.NotFoundException

when the animation cannot be loaded

loadInterpolator

public static @NonNull Interpolator loadInterpolator(
    @NonNull Context context,
    @AnimatorRes @InterpolatorRes int id
)

Loads an Interpolator object from a resource

Parameters
@NonNull Context context

Application context used to access resources

@AnimatorRes @InterpolatorRes int id

The resource id of the animation to load

Returns
@NonNull Interpolator

The animation object reference by the specified id

Throws
android.content.res.Resources.NotFoundException

when interpolator resources cannot be loaded