我的 Activity 中有 5 张图片。
我想缩放每个大图像并在一个线程中将它一张一张地重新缩放到小尺寸。
我是 android 的新手,所以请给我一些可以帮助我更好地理解的例子。
谢谢
最佳答案
例子:
public static Bitmap getResizedBitmap(Bitmap srcBitmap, int newWidth,
int newHeight) {
try {
return Bitmap.createScaledBitmap(srcBitmap, newWidth, newHeight,
true);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
在 Activity 中:
ImageView image= (ImageView) findViewById(R.id.image);
image.setImageBitmap(getResizedBitmap(bitmapImage, 120, 120));
关于android - 如何在android中缩放图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17087873/