Android: Rotate image in imageview by an angle

前端 未结 25 2602
野趣味
野趣味 2020-11-22 06:35

I am using the following code to rotate a image in ImageView by an angle. Is there any simpler and less complex method available.

ImageView iv = (ImageView)f         


        
相关标签:
25条回答
  • 2020-11-22 07:26

    Also, if you want to rotate an ImageView by 180 degrees vertically or horizontally, you can use scaleY or scaleX properties and set them to -1f. Here is a Kotlin example:

    imageView.scaleY = -1f
    imageView.scaleX = -1f
    

    1f value is used to return an ImageView to its normal state:

    imageView.scaleY = 1f
    imageView.scaleX = 1f
    
    0 讨论(0)
提交回复
热议问题