在Android studio中,同时存在drawable目录和mipmap目录,二者没有明显区别,但是工作机制还是存在差别。
谷歌官方:
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.
解释:
mipmap——用于存放原生图片(图ic_launcher.png),缩放上有性能优化;
drawable——存放图片、xml,和Eclipse没有区别;
本文详细解析了Android开发中drawable和mipmap目录的区别与用途。drawable主要用于存放各种类型的图片资源和Drawable对象,而mipmap则专为应用图标设计,提供不同密度屏幕的最佳分辨率图标,提升性能。
787

被折叠的 条评论
为什么被折叠?



