安卓属性动画设置无限循环播放
2019-09-27 本文已影响0人
蓝不蓝编程
完整代码
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.duration = animateTime
animation.interpolator = LinearInterpolator()
srcView.startAnimation(animation)
}
关键代码
animation.repeatCount = Animation.INFINITE