帧动画代码实现示例

    ImageView image = (ImageView) findViewById(R.id.frame_image);
        final AnimationDrawable anim = new AnimationDrawable();
        for (int i = 1; i <= 14; i++) {
            int id = getResources().getIdentifier("list_icon_gif_playing" + i, "drawable", getPackageName());//获取本地drawable资源文件
            Drawable drawable = getResources().getDrawable(id);
            anim.addFrame(drawable, 60);
        }

        anim.setOneShot(false);
        image.setBackgroundDrawable(anim);

        anim.start();
原文地址:https://www.cnblogs.com/loaderman/p/10194881.html