2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AndroidのViewを回転させ続ける方法

Last updated at Posted at 2020-09-17
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)
    }
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?