Android动画

RotateAnimation 旋转动画

ImageView img;
        img=new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
                        Animation.RELATIVE_TO_SELF, 0.5f);
        img.setDuration(TIME_MINISECONDS_DURATION_RECOGNIZE);
        img.setInterpolator(new LinearInterpolator());
        img.setRepeatCount(Animation.INFINITE);
        //去掉动画
        img.clearAnimation();

AlphaAnimation 淡入淡出动画

// Change alpha from fully visible to
   final Animation animation = new AlphaAnimation(1, 0); // invisible

        animation.setDuration(TIME_MINISECONDS_MIC_FLICKER); // duration - 1/5 a second
        animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
        animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
        animation.setRepeatMode(Animation.REVERSE); //
        img.setAnimation(animation);
        //去掉动画
        img.clearAnimation();

TranslateAnimaiton 位移动画

final TranslateAnimation animation = new TranslateAnimation(0, 150,0, 0); 
animation.setDuration(2000);//设置动画持续时间 
animation.setRepeatCount(2);//设置重复次数 
animation.setRepeatMode(Animation.REVERSE);//设置反方向执行 

DrawableAnimation 帧动画

 AnimationDrawable frameAnim = new AnimationDrawable();
        frameAnim.setOneShot(false);

        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0006), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0007), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0008), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0009), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0010), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0011), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0012), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0013), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0014), 70);
        frameAnim.addFrame(getResources().getDrawable(R.drawable.ren0015), 70);
        img.setBackground(frameAnim);
        frameAnim.start();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值