Android Studio(AS)-->drawable与mipmap (官网解释)

阅读前提: 你需要提前了解 drawable 和 mipmap 是什么;

使用Android Studio IDE, 新建Android项目的时候,程序(APP)启动图标ic_launcher.png,没有在之前的老地方(drawable目录),而是出现在mipmap目录结构下;

为了一探究竟,翻阅了Android 开发者官网(http://developer.android.com);

找到以下解释:

main/res/
    Contains application resources, such as drawable files, layout files, and string                  values in the following directories. See Application Resources for more information.

    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.

恕我英语能力不足,无法翻译;
原文地址:http://developer.android.com/intl/zh-cn/tools/projects/index.html#ApplicationModules

勉强使用工具翻译,大致内容如下:
    drawable/
用于图片文件(PNG, JPEG , or GIF), .9图片文件 和 XML文件;
    mipmap/
用于App Launcher图标;

其他官网相关阅读地址:
http://developer.android.com/intl/zh-cn/tools/projects/index.html#mipmap

http://developer.android.com/intl/zh-cn/guide/practices/screens_support.html#support


补充阅读:
两者使用上没有任何区别,你把它当drawable用就好了。唯一的区别就是用mipmap系统会在缩放上提供一定的性能优化。

比如:
Nexus 6 有 493 ppi,它刚好在 xxhdpi和xxxhdpi之间,所以显示的时候需要对xxxhdpi的资源进行缩小,如果你用了mipmap-xxxhdpi,那么这里会对sclae有一个优化,性能更好,占用内存更少。所以现在官方推荐使用mipmap.


至此: 文章就结束了,如有疑问: QQ群:274306954 欢迎您的加入.

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值