我正在使用通用图像加载器在 ImageView 中显示位图。但是当下载位图时,我想重新缩放它,然后应该缓存重新缩放的位图......我无法确定需要修改以实现我的目的的那个点。
问问题
1222 次
1 回答
3
UILDisplayImageOptions
有一个imageScaleType
参数,它采用ImageScaleType
. 文档ImageScaleType
清楚地表明,缩放发生在图像被缓存之前:
/** * Image will scaled-down exactly to target size (scaled width or height or both * will be equal to target size; depends on ImageView's scale type). Use it if * memory economy is critically important. * Note: If original image size is smaller than target size then original image * won't be scaled. * * NOTE: For creating result Bitmap (of exact size) additional Bitmap will be * created with Bitmap#createBitmap(...) * Cons: Saves memory by keeping smaller Bitmap in memory cache (comparing with * IN_SAMPLE... scale types) * Pros: Requires more memory in one time for creation of result Bitmap. */
因此,在 DisplayOptions 中设置 ImageScaleType 并享受缓存中的缩放位图。
于 2013-11-06T07:20:29.357 回答