1

我正在使用通用图像加载器在 ImageView 中显示位图。但是当下载位图时,我想重新缩放它,然后应该缓存重新缩放的位图......我无法确定需要修改以实现我的目的的那个点。

4

1 回答 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 回答