`

mipmap-xxx

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

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

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

Different home screen launcher apps on different devices show app launcher icons at various resolutions. When app resource optimization techniques remove resources for unused screen densities, 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的历史:
https://androidbycode.wordpress.com/2015/02/14/goodbye-launcher-drawables-hello-mipmaps/

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.

分享到:
评论

相关推荐

    Android Studio 3.0中mipmap-anydpi-v26是什么东东

    在Android开发环境中,Android Studio 3.0引入了一个新的特性,即`mipmap-anydpi-v26`文件夹。这个文件夹的出现是为了支持Android 8.0 (API级别26)及更高版本中的自适应图标(Adaptive Icons)。自适应图标是一种...

    Android icon适配mipmap

    mipmap-ldpi 36*36 px 四周留出1个像素用于填充(无底色) mipmap-mdpi 48*48 px 四周留出1个像素用于填充(无底色) mipmap-hdpi 72*72 px 四周留出2个像素用于填充(无底色 mipmap-xhdpi 96*96 px 四周留出4个像素...

    android studio 关于把图片放在mipmap中的问题

    今天写项目的时候试着把图片放在了mipmap-mdpi文件中。如果你问你的项目没有mipmap文件夹,只有mipmap,那么请看图   我想现在你应该明白了。 —————— 扯回正题: 当你把图片放在mipmap文件之后,首先要修改的...

    android-自定义-悬浮弹窗

    在Android开发中,自定义悬浮弹窗是一种常见的需求,它能够提供一种轻量级的交互方式,用于显示临时的通知或操作。本教程将深入探讨如何在Android应用中创建和使用自定义的悬浮弹窗。 首先,我们需要理解Android的...

    ConstraintLayout小计里提到的资源文件,图片和布局文件

    1. **mipmap-xxxhdpi, mipmap-hdpi, mipmap-xxhdpi, mipmap-xhdpi, mipmap-mdpi**: 这些是Android系统用来存储不同密度的图标和其他图形资源的目录。Android设备有不同的屏幕密度,如高清(hdpi)、超高清(xxhdpi...

    android 应用修改图标Demo

    1. **创建新图标资源**:在项目中,通常在`res/mipmap-*`(如`res/mipmap-hdpi`, `res/mipmap-mdpi`, `res/mipmap-xhdpi`, `res/mipmap-xxhdpi`, `res/mipmap-xxxhdpi`)目录下,为不同密度的设备创建新的图标文件。...

    Android dimens dimens源码720p,1080p资源包

    在Android开发中,屏幕适配是一项重要的任务,尤其在当今设备种类繁多、屏幕尺寸各异的情况下。本资源包提供了一种使用`dimens.xml`文件进行屏幕适配的方法,适用于720p和1080p两种常见分辨率。...

    Flutter-设置.pdf

    例如:mipmap-hdpi - 72*72、mipmap-mdpi - 48*48、mipmap-xhdpi - 96*96、mipmap-xxhdpi - 144*144、mipmap-xxxhdpi - 192*192 在 iOS 平台上,修改应用程序图标可以在 Assets.xcassets/AppIcon.appiconset 目录中...

    安卓传感器app 图片素材

    这个app的图片素材包含了不同分辨率的图标和图像,分别对应了Android的不同屏幕密度:mipmap-xxxhdpi-v4、mipmap-hdpi-v4、drawable-mdpi-v4、drawable-xxhdpi-v4、drawable-xhdpi-v4、mipmap-xhdpi-v4、mipmap-...

    AndroidLauncherIconResizer:快速将图像大小从URL或文件调整为与Android兼容的Mipmap可绘制启动器图标,以适应各种屏幕密度

    快速将图像大小从URL或文件调整为与Android兼容的Mipmap可绘制启动器图标,以适应各种屏幕密度 用法 source venv/bin/activate pip install -r requirements.txt 然后,要使用该脚本,您可以从URL抓取图像: ...

    Android原生方式实现夜间模式

    在Android开发中,夜间模式是一项重要的功能,它允许用户在暗环境下使用应用时降低屏幕亮度,减轻眼睛疲劳。本文将详细讲解如何通过原生方式在Android应用中实现夜间模式。 首先,我们需要理解Android中的资源多态...

    Unity调用网页页面Embedded Browser插件

    Features - Render sites to 2D or 3D objects - Chromium backend;... - Call JavaScript1 from Unity - Call Unity from JavaScript1 ... - Mipmap-emulation shader: faster texture updates without sparkles -

    Android应用图标 3配色 包含所有分辨率 可商用

    包含所有分辨率,有mipmap-hdpi-mhdpi-xhdpi-xxhdpi-xxxhdpi。 这个图标适合用于现代科技产品或服务中。 例如: 应用程序图标:在移动设备或电脑上作为某个软件或工具的标识。 品牌标志:作为公司、组织或产品的...

    Android地图定位googleSDK使用

    在Android开发中,集成Google Maps SDK和Google Location SDK是实现地图展示、定位功能的重要环节。本文将详细讲解如何使用这两个SDK来实现相应的功能,并提供一些关键知识点。 首先,我们需要在项目中添加Google ...

    基于AndroidStudio打地鼠小游戏源代码

    《基于Android Studio的打地鼠小游戏开发详解》 在移动设备普及的今天,游戏开发成为了一个热门领域,尤其是针对智能手机和平板电脑的Android平台。本文将深入探讨如何使用Android Studio开发一款打地鼠小游戏,...

    Android代码-piggybudget

    [[./android/app/src/main/res/mipmap-mdpi/ic_launcher.png]] piggybudget - easily manage your pocket money ** What is it, in bullet points? It’s a tiny app that I wrote for myself to keep track of my...

    Android开发自学笔记(二):工程文件剖析

    此外,res目录下还有其他子目录,如`menu`用于定义应用的菜单项,`mipmap-xxx`用于存放启动图标,`anim`存放动画资源,`raw`存放音频和非XML格式的文件,以及`xml`存放自定义的XML配置文件等。 理解这些基本文件...

    AndroidQ(10)黑暗模式适配的实现

    Android Q(10)引入了全局黑暗模式,这是对用户界面的一个重大改进,尤其是在节省电池和在暗光环境下提供舒适视觉体验方面。黑暗模式的适配对于开发者来说是一项重要的任务,因为它涉及到应用主题、颜色、字体和...

    qt opengl mipmap纹理

    在本文中,我们将深入探讨Qt与OpenGL结合使用时如何实现Mipmap纹理,并与普通纹理进行对比。 Mipmap(源自拉丁语“mappa mundi”,意为世界地图)是一种优化纹理的方法,它预先计算并存储一系列不同分辨率的纹理,...

Global site tag (gtag.js) - Google Analytics