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?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val displayMetrics = DisplayMetrics() | |
windowManager.defaultDisplay.getMetrics(displayMetrics) | |
val deviceWidth = displayMetrics.widthPixels | |
val deviceHeight = displayMetrics.heightPixels |
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() | |
} | |
} |