Start AnimationDrawable at specific frame?

那年仲夏 提交于 2019-12-13 04:48:43

问题


I got an AnimationDrawable like so:

 AnimationDrawable ani = new AnimationDrawable();       
        ani.addFrame(first, duration);
        ani.addFrame(second, duration);
        ani.addFrame(third, duration);
        ani.setOneShot(true);

And started like so:

ani.start();

I was wondering if it is possible to start directly, at lets say the second frame. Are there any ways of doing this? I need it for a game where I want to be able to resume the exact frame as when I hit my pause button calling:

ani.stop();

For now it starts the entire animation again after resumeing from "pause mode".


回答1:


When animtaion stop,use this method : ani.selectDrawable(index);



来源:https://stackoverflow.com/questions/13867437/start-animationdrawable-at-specific-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!