Last active
October 7, 2019 12:40
-
-
Save wooooooak/d56c1ac4005e78fd1718d95831f1e9cd to your computer and use it in GitHub Desktop.
(Android) Rotate imageView 90 degree continuously whenever you touch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
myImageView.setOnClickListener { | |
val currentDegree = it.rotation | |
ObjectAnimator.ofFloat(it, View.ROTATION, currentDegree, currentDegree + 90f) | |
.setDuration(300) | |
.start() | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment