Added in API level 23
Animatable2
public
interface
Animatable2
implements
Animatable
android.graphics.drawable.Animatable2 |
Abstract class that drawables supporting animations and callbacks should extend.
Summary
Nested classes | |
---|---|
class |
Animatable2.AnimationCallback
|
Public methods | |
---|---|
abstract
void
|
clearAnimationCallbacks()
Removes all existing animation callbacks. |
abstract
void
|
registerAnimationCallback(Animatable2.AnimationCallback callback)
Adds a callback to listen to the animation events. |
abstract
boolean
|
unregisterAnimationCallback(Animatable2.AnimationCallback callback)
Removes the specified animation callback. |
Inherited methods | |
---|---|
Public methods
clearAnimationCallbacks
Added in API level 23
public abstract void clearAnimationCallbacks ()
Removes all existing animation callbacks.
registerAnimationCallback
Added in API level 23
public abstract void registerAnimationCallback (Animatable2.AnimationCallback callback)
Adds a callback to listen to the animation events.
Parameters | |
---|---|
callback |
Animatable2.AnimationCallback : Callback to add.
This value cannot be null . |
unregisterAnimationCallback
Added in API level 23
public abstract boolean unregisterAnimationCallback (Animatable2.AnimationCallback callback)
Removes the specified animation callback.
Parameters | |
---|---|
callback |
Animatable2.AnimationCallback : Callback to remove.
This value cannot be null . |
Returns | |
---|---|
boolean |
false if callback didn't exist in the call back list, or true if
callback has been removed successfully. |
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,["# Animatable2\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Nested Classes](#nestedclasses) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nAnimatable2\n===========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/graphics/drawable/Animatable2 \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nAnimatable2\n`\n\n\n`\n\n\nimplements\n\n`[Animatable](/reference/android/graphics/drawable/Animatable)`\n\n\n`\n\n|---------------------------------------|\n| android.graphics.drawable.Animatable2 |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [AnimatedImageDrawable](/reference/android/graphics/drawable/AnimatedImageDrawable), [AnimatedVectorDrawable](/reference/android/graphics/drawable/AnimatedVectorDrawable) |---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AnimatedImageDrawable](/reference/android/graphics/drawable/AnimatedImageDrawable) | [Drawable](/reference/android/graphics/drawable/Drawable) for drawing animated images (like GIF). | | [AnimatedVectorDrawable](/reference/android/graphics/drawable/AnimatedVectorDrawable) | This class animates properties of a [VectorDrawable](/reference/android/graphics/drawable/VectorDrawable) with animations defined using [ObjectAnimator](/reference/android/animation/ObjectAnimator) or [AnimatorSet](/reference/android/animation/AnimatorSet). | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAbstract class that drawables supporting animations and callbacks should extend.\n\nSummary\n-------\n\n| ### Nested classes ||\n|----------|-----------------------------------------------------------------------------------------------------|\n| ` class` | [Animatable2.AnimationCallback](/reference/android/graphics/drawable/Animatable2.AnimationCallback) |\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[clearAnimationCallbacks](/reference/android/graphics/drawable/Animatable2#clearAnimationCallbacks())`() ` Removes all existing animation callbacks. |\n| ` abstract void` | ` `[registerAnimationCallback](/reference/android/graphics/drawable/Animatable2#registerAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback))`(`[Animatable2.AnimationCallback](/reference/android/graphics/drawable/Animatable2.AnimationCallback)` callback) ` Adds a callback to listen to the animation events. |\n| ` abstract boolean` | ` `[unregisterAnimationCallback](/reference/android/graphics/drawable/Animatable2#unregisterAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback))`(`[Animatable2.AnimationCallback](/reference/android/graphics/drawable/Animatable2.AnimationCallback)` callback) ` Removes the specified animation callback. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[android.graphics.drawable.Animatable](/reference/android/graphics/drawable/Animatable)` ` |---------------------|------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[isRunning](/reference/android/graphics/drawable/Animatable#isRunning())`() ` Indicates whether the animation is running. | | ` abstract void` | ` `[start](/reference/android/graphics/drawable/Animatable#start())`() ` Starts the drawable's animation. | | ` abstract void` | ` `[stop](/reference/android/graphics/drawable/Animatable#stop())`() ` Stops the drawable's animation. | ||\n\nPublic methods\n--------------\n\n### clearAnimationCallbacks\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void clearAnimationCallbacks ()\n```\n\nRemoves all existing animation callbacks.\n\n\u003cbr /\u003e\n\n### registerAnimationCallback\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void registerAnimationCallback (Animatable2.AnimationCallback callback)\n```\n\nAdds a callback to listen to the animation events.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------------------|\n| `callback` | `Animatable2.AnimationCallback`: Callback to add. This value cannot be `null`. \u003cbr /\u003e |\n\n### unregisterAnimationCallback\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean unregisterAnimationCallback (Animatable2.AnimationCallback callback)\n```\n\nRemoves the specified animation callback.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------|\n| `callback` | `Animatable2.AnimationCallback`: Callback to remove. This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|---------------------------------------------------------------------------------------------------------------------|\n| `boolean` | `false` if callback didn't exist in the call back list, or `true` if callback has been removed successfully. \u003cbr /\u003e |"]]