mipmap-xxx

最近在看AOSP,发现mipmaps, 百度 了一下,发现有各种说法,最后还是google出来的比较正确。

引用官方文档中:
[url]http://developer.android.com/tools/projects/index.html#mipmap[/url]

[size=large][size=medium]Managing Launcher Icons as mipmap Resources[/size][/size]

Different home screen launcher apps on different devices show app launcher icons at various resolutions. When [color=red]app resource optimization techniques remove resources for unused screen densities[/color], launcher icons can wind up looking fuzzy because the launcher app has to upscale a lower-resolution icon for display. To avoid these display issues, apps should use the mipmap/ resource folders for launcher icons. The Android system preserves these resources regardless of density stripping, and ensures that launcher apps can pick icons with the best resolution for display.

Make sure launcher apps show a high-resolution icon for your app by moving all densities of your launcher icons to density-specific res/mipmap/ folders (for example res/mipmap-mdpi/ and res/mipmap-xxxhdpi/). The mipmap/ folders replace the drawable/ folders for launcher icons. For xxhpdi launcher icons, be sure to add the higher resolution xxxhdpi versions of the icons to enhance the visual experience of the icons on higher resolution devices.

Note: Even if you build a single APK for all devices, it is still best practice to move your launcher icons to the mipmap/ folders.

这里面有说到app resource optimization techniques remove resources for unused screen densities 这句是重点,说 app资源优化技术会将不需要的解析度的屏幕的资源移除掉,这样 Launcher App会使用低密度的 icon放大显示而导致了 icon 模糊。如果把icon放到mipmap/ folders 所有all densities 的都会被保留,这样匹配的时候会用高密度的 icon去缩小显示,这样就避免了模糊。

这里提到到app resource optimization techniques,我还没有搜索到相关信息。

有一篇文章说明了mipmap的历史:
[url]https://androidbycode.wordpress.com/2015/02/14/goodbye-launcher-drawables-hello-mipmaps/[/url]

Why use mipmaps for your launcher icons?

Using mipmaps for your launcher icon is described as best practice by the Android team. The advantage you get is that you can keep resources in the mipmap folders for all device densities and then strip out other resources from the drawable folders that are not relevant to the specific users device density.

Here is an example, say a user has a device that is classified as xxhdpi. The drawable resources in your apk for all other densities, such as xxxhdpi, are not required and can be stripped out. The launcher icon is different to other resources as it is possible that a higher resolution icon is displayed in the users launcher. If that higher resolution image has been stripped from your drawables folder, then a lower density icon will programmatically be up-scaled. This may cause an unattractive blurry icon.

You may not be producing multiple apk files with stripped out resources to minimize apk size yet. Therefore making the change to mipmaps for your launcher icon will currently not make any difference. That does not mean you should not do it. The best reason for using mipmaps folder is that the Android team want you to and describe it as best practice. They know what new features are in the pipeline for Android and who knows, but maybe they are planning to introduce a new feature where unused resources are automatically stripped for the user when they download apps.

History of launcher mipmaps in Android

The mipmaps resource folders in Android started appearing long before they were introduced to the wider Android development community to use, which started in Android Jelly Bean 4.3. Very little official information came from the Android team about why to use them. Around the time of the release of 4.3, Android framework developer @hackbod announced:

…if you are building different versions of your app for different densities, you should know about the “mipmap” resource directory. This is exactly like “drawable” resources, except it does not participate in density stripping when creating the different apk targets.

Since that time if you have taken a close look at the apps produced out of Google you will notice that some apps were doing exactly that. Shipping only the required density but including all densities in the mipmap folders for the launcher icons.

As time went on still there was not much noise out of the Android team about using launcher mipmaps, that was until Lollipop hit AOSP and the new Nexus devices hit the market. The Android Developers blog posted about preparing your apps for the new Nexus 6 and 9. This detailed a compelling reason you should use mipmap folders for your app icon and announced the shift of best practice to using mipmaps:

…Provide at least an xxxhdpi app icon because devices can display large app icons on the launcher. It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density. For example, an xxxhdpi app icon can be used on the launcher for an xxhdpi device.
syncrypto可以用来将一个文件夹里面所有文件同步到另外一个加密的文件夹中, 一般来说,可以这样使用: syncrypto                         syncrypto 文件夹A  <---------------------> 加密文件夹B <-------------------> 文件夹C  机器X              (可以放在不安全的地方,例如云存储                机器Y 加密文件夹B中的文件都是加密过的,所以可以把它放在不怎么安全的地方(例如云盘,公共硬盘等) 明文文件和加密文件是一一对应的关系,所以每次同步只会添加(删除/修改)那些需要的文件,这样 很适合那些基于文件系统的同步工具,例如云盘、rsync等。 同步过程是双向的,所以,文件不仅仅是从明文文件夹同步到加密文件夹,同样也会从加密文件夹同步到 明文文件夹,syncrypto会根据算法选择最新的。 如果有冲突的话,syncrypto会将明文文件重命名(加上单词conflict),然后将密文文件同步过来 syncrypto是不会删除文件的,如果同步过程中需要删除或者覆盖文件,syncrypto会将文件移动 到废纸篓里面。密文文件夹的废纸篓在_syncrypto/trash下,明文文件夹的废纸篓在 .syncrypto/trash下。密文文件夹废纸篓里面的文件一样是加密过的。 主要 Feature : 双向加密同步 加密文件与明文文件是一一对应的关系 灵活的同步规则配置(方便将某些不必要同步的文件排除) 同时支持 Python2,Python3, Windows, Linux, OS X 比较全面的测试用例覆盖 标签:syncrypto
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值