Android播放暂停帧动画

ImageView mAnimImg;

AnimationDrawable mAnimDrawable;


public void handleAnim(boolean isPlaying) {
    mAnimDrawable = (AnimationDrawable) mAnimImg.getDrawable();
    if (mAnimDrawable == null) {
        mAnimDrawable = (AnimationDrawable) getDrawable(R.drawable.bg_anim);
        mAnimImg.setImageDrawable(mAnimDrawable);
    }
    if (isActivice) {
        if (mAnimDrawable != null) {
            mAnimDrawable.start();
        }
    } else {
        if (mAnimDrawable != null) {
            mAnimDrawable.stop();
        }
    }
}

你可能感兴趣的:(Android播放暂停帧动画)