BitmapDrawable bitmapDrawable = (BitmapDrawable) imageView.getDrawable();
//如果图片还未回收,先强制回收该图片
if(!bitmapDrawable.getBitmap().isRecycled())
{
bitmapDrawable.getBitmap().recycle();
}
//然后再显示新的图片
imageView.setImageBitmap(BitmapFactory.decodeStream(assetFile));
本文介绍了如何在Android中强制回收未回收的BitmapDrawable,并通过解码流展示新的图片,以优化内存使用和提高应用性能。
183

被折叠的 条评论
为什么被折叠?



