我得到了一种数据的示意图,该数据存储为矢量绘图,是从 SVG 格式的原始图像获得的。我需要放大和缩小它,但是在更改
scaleX
和 scaleY
参数后,图像变得模糊。你能帮我通过重新绘制来改变图像的大小吗,以使文本和其他元素看起来不像过度缩放的 PNG。
我的代码:
imageView = findViewById<ImageView>(R.id.image_view).apply {
scaleX = 3f
scaleY = 3f
invalidate()
}
试试这个代码
imageView = findViewById<ImageView>(R.id.image_view).apply {
scaleX = 3f
scaleY = 3f
invalidate()
setImageBitmap(Bitmap.createScaledBitmap(bitmap, width * scaleX, height * scaleY, true))
}