【发布时间】:2013-06-04 18:53:17
【问题描述】:
我正在使用此功能减小图像的大小:
Drawable reduceImageSize (String path)
{
BitmapDrawable bit1 = (BitmapDrawable) Drawable.createFromPath(path);
Bitmap bit2 = Bitmap.createScaledBitmap(bit1.getBitmap(), 640, 360, true);
BitmapDrawable bit3 = new BitmapDrawable(getResources(),bit2);
return bit3;
}
它工作正常,唯一的问题是当我多次调用这个函数时应用程序变慢了,有没有办法优化这个函数?也许通过矩阵减小尺寸? 另外我正在从 SD 卡中读取图像,并且需要将背面作为动画的 Drawable,而此功能提供了这一点。
【问题讨论】: