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

前端之家收集整理的这篇文章主要介绍了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.f2er.com/android/312257.html

猜你在找的Android相关文章