📜  android studio 旋转 imageview - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:33.631000             🧑  作者: Mango

代码示例1
val bitmap =
  binding.image.drawable.toBitmap(
               binding.image.drawable.intrinsicWidth,
               binding.image.drawable.intrinsicHeight
            )
val matrix = Matrix()
matrix.postRotate(90f)
val rotated = 
  Bitmap.createBitmap(
        bitmap,
               0,
            0,
        binding.image.drawable.intrinsicWidth,
        binding.image.drawable.intrinsicHeight,
        matrix,
            true
     )
  
binding.image.setImageBitmap(rotated)