仿IPhone 长按图标删除应用,图标抖动效果

使用ValueAnimator类实现,长点击图标,图标抖动的效果,可以自己规定抖动的程度大小。

由于Animator类是在android3.0之后才加上去的,所以,为了兼容3.0以下的机子,就导入了nineoldandroid.jar包,实现兼容。

工程源代码:

点击下载

抖动另一种实现方式:

private Animation rotateAnimation() {
        Animation rotate = new RotateAnimation(-2.0f,
                                          2.0f,
                                          Animation.RELATIVE_TO_SELF,
                                          0.5f,
                                          Animation.RELATIVE_TO_SELF,
                                          0.5f);

         rotate.setRepeatMode(Animation.REVERSE);
        rotate.setRepeatCount(Animation.INFINITE);
        rotate.setDuration(60);
        rotate.setInterpolator(new AccelerateDecelerateInterpolator());

        return rotate;
    }

开始抖动:

view.startAnimation(rotateAnimation);

停止抖动:

view.clearAnimation();

 

相关文章:

  • 2021-12-22
  • 2021-11-22
  • 2021-11-27
  • 2021-11-04
  • 2022-01-13
  • 2021-12-31
  • 2021-12-05
猜你喜欢
  • 2021-07-12
  • 2021-12-20
  • 2021-12-31
  • 2021-09-16
  • 2021-09-13
  • 2021-05-19
  • 2021-11-27
  • 2021-11-23
相关资源
相似解决方案