andrlid 处理大图片思路,未实践

Loading Large Bitmaps Efficiently

先不解码,读取image的宽高,然后降采样显示图片。
 

参考:http://developer.android.com/training/displaying-bitmaps/load-bitmap.html

Images come in all shapes and sizes. In many cases they are larger than required for a typical application user interface (UI). For example, the system Gallery application displays photos taken using your Android devices's camera which are typically much higher resolution than the screen density of your device.

Given that you are working with limited memory, ideally you only want to load a lower resolution version in memory. The lower resolution version should match the size of the UI component that displays it. An image with a higher resolution does not provide any visible benefit, but still takes up precious memory and incurs additional performance overhead due to additional on the fly scaling.

This lesson walks you through decoding large bitmaps without exceeding the per application memory limit by loading a smaller subsampled version in memory.

看stackover flow上一个帖子,也是这个思路:

http://stackoverflow.com/questions/477572/strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object/823966#823966

原文地址:https://www.cnblogs.com/stevenlxq/p/3405872.html