微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 由于图像而造成的大型应用大小.如何压缩.PNG图像?

我开发的应用程序有很多图像可以工作,因为我的应用程序的大小已经变得非常大.我想压缩或类似的东西来减少应用程序的大小.任何想法?

解决方法

在编译您的应用程序时,放置在res / drawable中的.png文件automatically optimized

Bitmap files may be automatically optimized with lossless image
compression by the aapt tool during the build process.
For example,a
true-color PNG that does not require more than 256 colors may be
converted to an 8-bit PNG with a color palette. This will result in an
image of equal quality but which requires less memory. So be aware
that the image binaries placed in this directory can change during the
build. If you plan on reading an image as a bit stream in order to
convert it to a bitmap,put your images in the res/raw/ folder
instead,where they will not be optimized.

话虽如此,你还有更多的选择.来自Google I / O 2016的“Image Compression for Android Developers”的这个话题有很好的发言,它概述了可能性,解释了他们的不足之处,并给出了一些一般的最佳实践.

如果您的应用程序的大小要高于市场上的发布,那么您也可以

>发送您的应用程序没有图像,并将它们从互联网加载到手机SD卡时,应用程序第一次启动
>使用Android本身的APK Extension Files,这基本上是一样的,但你不必自己做一切.

原文地址:https://www.jb51.cc/android/312257.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐