SampleFragment.kt
private fun rotateLoadingImage() {
// 画像の中心を軸に回転させる
val rotate = RotateAnimation(
0f,
360f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
)
// 一回転にかかる時間(ms)
rotate.duration = 3000
// 回転速度を一定にする
rotate.interpolator = LinearInterpolator()
// 無限リピート
rotate.repeatCount = Animation.INFINITE
// ImageViewのstartAnimationメソッドを呼び出す
image_loading.startAnimation(rotate)
}