如何运行比单时间更多的动画序列 [英] How to run animation sequences more than single time

查看:147
本文介绍了如何运行比单时间更多的动画序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的顺序在我的项目的动画。我已设置onClickListener到该图像这里我把动画序列。现在,当第一次我运行code和点击图片,它正常启动运行动画,但随后它从来没有上点击再次运行。我要再次运行code。所以,我怎么可以运行超过一次动画序列?我已经把我的codebelow启动动画序列。


  

image.setOnClickListener(新OnClickListener(){

  @覆盖
      公共无效的onClick(视图v){          // TODO自动生成方法存根          animation_door =(AnimationDrawable)image.getBackground();
          animation_door.start();


  
  

}});



解决方案

好了,点击您的按钮,再次之前,你也必须停止动画,所以你可以尝试像这样,

  image.setOnClickListener(新OnClickListener(){            @覆盖
            公共无效的onClick(视图v){                animation_door =(AnimationDrawable)image.getBackground();
                animation_door.stop();
                animation_door.start();
              }
          });

希望这有助于
苏瑞Sahani。

I am using sequence for animation in my project. I have set onClickListener to that image where I put animation sequences. now when first time I run the code, and click on image, it start run animation correctly but then it never run again on click. I have to again run the code. So how I can run animation sequences more than one time? I have put my codebelow to start animation sequence.

image.setOnClickListener(new OnClickListener() {

      @Override           
      public void onClick(View v) {

          // TODO Auto-generated method stub

          animation_door = (AnimationDrawable) image.getBackground();
          animation_door.start();             

} });

解决方案

Well, Before clicking your button again you have to stop the animation also, so you can try it like this,

 image.setOnClickListener(new OnClickListener() {

            @Override           
            public void onClick(View v) {

                animation_door = (AnimationDrawable) image.getBackground();
                animation_door.stop();
                animation_door.start();         
              }
          });

Hope this helps, Suri Sahani.

这篇关于如何运行比单时间更多的动画序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆