对于Android应用程序图像尺寸 [英] Image size for android app

查看:96
本文介绍了对于Android应用程序图像尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我想使用图片的每一个产品项目。此图像必须被添加到产品时,用户创建新的项目产品。什么尺寸的图像的最佳方法? (在100×100像素或200×200像素,例如重新大小的图片)

In my app I want use images for every product item. This image must be added to product when user create new item product. What the best approach about size image? (e.g. re-size image in 100x100 px or 200x200 px)

推荐答案

关于图片的大小和应用程序的内存消耗。这些信息可以为您节省了Android发展的一些痛苦的时候。

About size of Images and memory consumption of an application. This information can save you some painful time with android development.

取下帐户的大部分时间,这将影响到您的应用程序性能 例如在大多数情况下,应用程序的使用的内存将采取:   x个象素* Y像素* 4(字节)

take under account that most of the time this will affect your app performance e.g. on most cases the used memory of the app will take: x pixels * y pixels * 4 (bytes)

(你可以改变RGB编码code,使最后一个参数2或1,这将影响图像的颜色)

(you can change rgb encoding code to make the last parameter 2 or 1 that will effect image colors)

所以,100 * 100 * 4 = 40000字节= 40 KB 但低于你看:  让我们的1280 * 800 * 4 = 4096000个字节,也就是大约400万个字节的平板电脑设置。以账户下,一些设备的最大内存为应用程序是16MB,你可能会被刮伤限制在设定值。

So 100 * 100 * 4 = 40000 bytes = 40 KB but below and behold: let's take a tablet setup of 1280 * 800 * 4 = 4096000 bytes, which is approximately 4 mega bytes. Taking under account that some devices max RAM for app is 16MB you might be scratching the limit at that setting.

和不要做什么我做了: 2560 * 1600 * 4 =〜16MB
这将有一点点不是每个图像16MB崩溃,许多Android设备内存的限制!不那么适用于大多数设备。

And don't do what I did with: 2560 * 1600 * 4 = ~16MB
That will crash many android devices RAM limit with a little bit more than 16MB per image!! not so adaptable to most devices.

我个人认为,在Android开发的图像不是很方便,但也许他们正在努力改善它。

Personally I think that the image in Android development is not very convenient, but maybe they are working to improve it.

这篇关于对于Android应用程序图像尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆