Stay organized with collections
Save and categorize content based on your preferences.
AnimatorInflater
open 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 constructors
AnimatorInflater
AnimatorInflater()
Public methods
loadAnimator
open static fun loadAnimator(
context: Context!,
id: Int
): Animator!
Loads an Animator
object from a resource
Parameters |
context |
Context!: Application context used to access resources |
id |
Int: The resource id of the animation to load |
Return |
Animator! |
The animator object reference by the specified id |
Exceptions |
android.content.res.Resources.NotFoundException |
when the animation cannot be loaded |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AnimatorInflater\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAnimatorInflater\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/animation/AnimatorInflater \"View this page in Java\") \n\n```\nopen class AnimatorInflater\n```\n\n|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.animation.AnimatorInflater](#) |\n\nThis class is used to instantiate animator XML files into Animator objects.\n\nFor 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.)\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------|---|\n| [AnimatorInflater](#AnimatorInflater())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open static [Animator](/reference/kotlin/android/animation/Animator)! | [loadAnimator](#loadAnimator(android.content.Context,%20kotlin.Int))`(`context:` `[Context](../content/Context.html#)!`, `id:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Loads an [Animator](/reference/kotlin/android/animation/Animator) object from a resource |\n| open static [StateListAnimator](/reference/kotlin/android/animation/StateListAnimator)! | [loadStateListAnimator](#loadStateListAnimator(android.content.Context,%20kotlin.Int))`(`context:` `[Context](../content/Context.html#)!`, `id:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### AnimatorInflater\n\n```\nAnimatorInflater()\n```\n\nPublic methods\n--------------\n\n### loadAnimator\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun loadAnimator(\n context: Context!, \n id: Int\n): Animator!\n```\n\nLoads an [Animator](/reference/kotlin/android/animation/Animator) object from a resource\n\n| Parameters ||\n|-----------|----------------------------------------------------------------------------------------------------------------------|\n| `context` | [Context](../content/Context.html#)!: Application context used to access resources |\n| `id` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The resource id of the animation to load |\n\n| Return ||\n|-----------------------------------------------------------|---------------------------------------------------|\n| [Animator](/reference/kotlin/android/animation/Animator)! | The animator object reference by the specified id |\n\n| Exceptions ||\n|---------------------------------------------------|-------------------------------------|\n| `android.content.res.Resources.NotFoundException` | when the animation cannot be loaded |\n\n### loadStateListAnimator\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun loadStateListAnimator(\n context: Context!, \n id: Int\n): StateListAnimator!\n```"]]