diff options
| author | 2011-05-27 12:54:09 -0700 | |
|---|---|---|
| committer | 2011-05-31 07:22:51 -0700 | |
| commit | f5534a0785db9dfa239d8b6c20b011993742d534 (patch) | |
| tree | df5744252577b0c80c495052f5e43ff27632406b | |
| parent | 8239b95d11d6bd68abce33f01d296b7edc6b786c (diff) | |
Fixes for AnimationDrawable
Set up AnimationDrawable with an initial frame when it is
constructed from code (via addFrame()). This is equivalent to
what is done when it is constructed via xml resources.
Change-Id: I86784a241268aa2d03af8edecbc80a7cc3548e19
| -rw-r--r-- | graphics/java/android/graphics/drawable/AnimationDrawable.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java index e275ba8941dd..2220f96d48ce 100644 --- a/graphics/java/android/graphics/drawable/AnimationDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java @@ -62,7 +62,7 @@ import android.util.AttributeSet; * AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); * * // Start the animation (looped playback by default). - * frameAnimation.start() + * frameAnimation.start(); * </pre> * <p>For more information, see the guide to <a * href="{@docRoot}guide/topics/resources/animation-resource.html">Animation Resources</a>.</p> @@ -192,6 +192,9 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An */ public void addFrame(Drawable frame, int duration) { mAnimationState.addFrame(frame, duration); + if (mCurFrame < 0) { + setFrame(0, true, false); + } } private void nextFrame(boolean unschedule) { |