完整代码
private fun rotate(srcView: View) {
val animateTime = 5000L
val animation = RotateAnimation(0f, 360f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
animation.fillAfter = true
//设置无线循环
animation.repeatCount = Animation.INFINITE
//设置匀速旋转
animation.interpolator = LinearInterpolator()
animation.duration = animateTime
srcView.startAnimation(animation)
}
关键代码
//设置无线循环
animation.repeatCount = Animation.INFINITE
//设置匀速旋转
animation.interpolator = LinearInterpolator()
关于我
厦门大学计算机专业 | 前华为工程师 分享编程技术,没啥深度,但看得懂,适合初学者。 Java | 安卓 | 前端 | 小程序 | 鸿蒙 公众号:花生皮编程