Android的PNG图像大内存

编程入门 行业动态 更新时间:2024-10-27 21:10:34
本文介绍了Android的PNG图像大内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在android的,有一个imageflipper的应用程序。问题是,经过约8个图像加载到内存中,我得到一个内存不足的错误。

I have an application in android that has an imageflipper. Problem is, after about 8 images loaded to memory, I get an out of memory error.

嗯,我试着做动态的图像加载,因此,如果用户翻转2图像,我会加载未来2至存储和删除2首当其冲。那种它的工作原理,但它是丑陋的,我有麻烦,当用户翻转图像回(imageflipper.show previous()),我真的不能转移所有图像,并把新的图像开始。

Well, I tried to do dynamic image loading, so that if the user flips 2 images, I'll load next 2 to memory and delete 2 first ones. It kind of works, but it is ugly and I have trouble when user flips images back(imageflipper.showprevious()), I can't really shift all images and place new images to the beginning.

我的问题是: 有没有更好的办法做这样的东西?调整图像大小并没有真正的帮助。

My question is: Is there a better way to do this kind of stuff? Resizing images didn't really help.

推荐答案

使用的 BitmapFactory.Options

BitmapFactory.Options opts = new BitmapFactory.Options(); opt.inSampleSize = 2; //this will decrease bitmap size, // but also affect quality of the image, //so just play with this value to spot the good one; Bitmap b = BitmapFactory.decodeFile(fileName, opts);

更多推荐

Android的PNG图像大内存

本文发布于:2023-07-26 19:04:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1217915.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   内存   Android   PNG

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!