开发者

Efficient retrieval of scaled asset bitmaps

开发者 https://www.devze.com 2023-03-26 20:07 出处:网络
I\'ve got a GridView of many images which are retrieved from the assets folder and decoded from streams. These are t开发者_JS百科ypically quite large (to be used elsewhere in the app), but for the Gri

I've got a GridView of many images which are retrieved from the assets folder and decoded from streams. These are t开发者_JS百科ypically quite large (to be used elsewhere in the app), but for the GridView need to only be 140dp wide or have a minimum height of 150dp. Which of the options in BitmapFactory.Options should I use to scale the image to this density/resolution? I'm confused by the many different density options.


For fast retrieval, you should use inSampleSize. It automatically loads a smaller bitmap without first loading the full image into memory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号