开发者

How to resize an image without stretching?

开发者 https://www.devze.com 2023-03-31 12:59 出处:网络
I have a bitmap of 128*128 size. I want to make it of size 256*256. But I don\'t want to stretch the image. Instead, my old image should be placed at the center of the new image and remaining pixels s

I have a bitmap of 128*128 size. I want to make it of size 256*256. But I don't want to stretch the image. Instead, my old image should be placed at the center of the new image and remaining pixels should be filled with a certain color, for example white.

How can I do this开发者_StackOverflow中文版?


ImageView have setScaleType(ScaleType type) method.

When ScaleType is http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

Try to play with it. Good luck!!

0

精彩评论

暂无评论...
验证码 换一张
取 消