這是我愛用的一套 library, 可以非常方便地讀取圖片。
以下直接用標題分類一些會用到的技巧

Crop 切割圖片

請參考 Universal Image Loader: Crop center image loading synchronously (no imageview) (Android, UIL)

[...Builder...].preProcessor(new BitmapProcessor() {
    public Bitmap process (Bitmap src) {
        // Roughly assuming that the bitmap is bigger than the needed dimensions
        // but you get the idea
        int xOffset = (src.getWidth() - width) / 2;
        int yOffset = (src.getHeight() - height) / 2;
        src.recycle();
        return result;
    }
})

Cache

http://stackoverflow.com/questions/13987479/how-to-force-a-cache-clearing-using-universal-image-loader-android
Universal Image Loader: Can I use cache but also refresh it?

請小心:MemoryCacheUtilsDiscCacheUtils 才是新的 Class 名稱

Comments

comments powered by Disqus
Copyright © 2013 Andro Chen
Powered by Logdown and Greyshade
Favicon from The Noun Project