• 软工超越日报-android的简单旋转效果实现 5/13


    今天我们来写一个简单的等待动画,使用了专门实现rotateAnimation

    代码如下:

    RotateAnimation rotate  = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    LinearInterpolator lin = new LinearInterpolator();
    rotate.setInterpolator(lin);
    rotate.setDuration(20000);//设置动画持续周期
    rotate.setRepeatCount(-1);//设置重复次数
    rotate.setFillAfter(true);//动画执行完后是否停留在执行完的状态
    rotate.setStartOffset(10);//执行前的等待时间

    ImageView ssp=(ImageView)findViewById(R.id.image_view);
    ssp.setAnimation(rotates);
    ssp.setAnimation(rotates);
    
    

    只需要指定好需要旋转的控件即可——是不是十分简单呢?

  • 相关阅读:
    Codeforces Round #534 (Div. 2) D. Game with modulo 交互题
    传球游戏 dp
    欧拉通路和欧拉回路
    HDU 1116
    HDU 4970
    HDU 4557
    HDU 4864
    HDU 1565
    HDU 3046
    HDU 4240
  • 原文地址:https://www.cnblogs.com/Sakuraba/p/14910904.html
Copyright © 2020-2023  润新知