Open jackyhieu1211-hn opened 4 years ago
Hello. Because the library does not support rotation. But if you want to rotate the image. You can do the following
I use kotlin
`
private var currentAngle = 0.0f
private fun rotateByAngle() {
if (currentAngle == -270f) {
currentAngle = 0f
} else {
currentAngle += -90f
}
val viewState = cropViewImage.saveState()
cropViewImage.restoreState(viewState)
val bitmap = cropViewImage.viewBitmap.rotate(-90f)
cropViewImage.setImageBitmap(bitmap)
}
`
fun Bitmap.rotate(degrees: Float): Bitmap {
val matrix = Matrix().apply { postRotate(degrees) }
return Bitmap.createBitmap(this, 0, 0, width, height, matrix, true)
}
Hello admin How to change rotation image view? Thanks