1

I created an animation in android with this code:

  AnimationDrawable animation = new AnimationDrawable();

    if (null == frames) {
        return animation;
    }
    for (int i = 0; i < frames.size(); i++) {
        animation.addFrame(frames.get(i), delay);
    }

    animation.setOneShot(!repetitive);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        view.setBackgroundDrawable(animation);
        //view.setBackground(animation);
    } else {
        view.setBackgroundDrawable(animation);
    }
    /* start the animation! */
    animation.start();

It works very well, but there is one problem when the drawables frames are in different sizes. The view loads the frame but streches it and scales down to the first frame size. I searched and read some answers in Stackoverflow but still can't find a fine answer.

Zach Bublil
  • 857
  • 10
  • 28

0 Answers0