如今,经过Android Studio建立Android工程,默认会建立mipmap文件夹,而不是之前的drawable文件夹。那么mipmap和drawable文件夹到底有什么区别呢? android
mipmap文件夹下的图标会经过Mipmap纹理技术进行优化。关于Mipmap纹理技术的介绍,请参考:Mipmap纹理技术简介后端
通过查询官方和第三方资料,得出结论:app
mipmap文件夹下,仅仅建议放启动图标/app launcher icons,也就是应用安装后,会显示在桌面的那个图标。而其余的图片资源等,仍是按照之前方式,放在drawable文件夹下。less
下面再详细阐述下,得出以上结论的依据:
1.google官方关于mipmap和drawable的定位大数据
drawable/
For bitmap files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or focused). See the Drawable resource type. 优化
mipmap/
For app launcher icons. The Android system retains the resources in this folder (and density-specific folders such as mipmap-xxxhdpi) regardless of the screen resolution of the device where your app is installed. This behavior allows launcher apps to pick the best resolution icon for your app to display on the home screen. For more information about using the mipmap folders, see Managing Launcher Icons as mipmap Resources.this
2.stackoverflow上关于mipmap和drawable的区别google
The mipmap folders are for placing your app icons in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.spa
以ic_launcher为例。
1.放在mipmap文件夹下时,引用方式以下:code
android:icon="@mipmap/ic_launcher"R.mipmap.ic_launcher
2.放在drawable文件夹下时,引用方式以下:
android:icon="@drawable/ic_launcher"R.drawable.ic_launcher
阿里百川(baichuan.taobao.com)是阿里巴巴集团“云”+“端”的核心战略是阿里巴巴集团无线开放平台,基于世界级的后端服务和成熟的商业组件,经过“技术、商业及大数据”的开放,为移动创业者提供可快速搭建App、商业化APP并提高用户体验的解决方案;同时提供多元化的创业服务-物理空间、孵化运营、创业投资等,为移动创业者提供全面保障。