我正在使用Universal Image Loader在ImageView中显示位图。但是当下载位图时我想重新调整它,然后重新调整位图应该被缓存....我无法确定需要修改以实现我的目的的那一点。
答案 0 :(得分:3)
UIL DisplayImageOptions
有一个imageScaleType
参数,需要ImageScaleType
。 The docs for 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并享受缓存中的缩放位图。