mipmap和drawable文件夹的区别

在Android上创建工程,会默认创建mipmap文件夹。之前在Eclipse上创建的是drawable的文件夹。那么这两个有什么区别呢?
问题:
I’m working with android studio 1.1 Preview 1
我使用android studio 1.1 Preview 1版本工作。
And I noticed that when I create a new project I’m getting next hierarchy:
我注意到当创建新的工程时,得到了下面的目录层级:
这里写图片描述
mipmap folders for diffrent DPIs, No more diffrent DPIs drawable folders.
4个不同分辨率的mipmap文件夹,与不同DPI的drawable文件夹没啥区别。
Should I put all my resources in the mipmap folders, or just the app icon?
我应该把所有资源都放到mipmap文件夹么?或者只放应用的图标?
答案:
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.
mipmap文件夹只放应用图标。其他需要使用的drawable资源象之前一样放到对应的drawable文件夹。
According to this Google blogpost:
根据这篇google的博文:
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.
应用的启动图标最好放到mipmap文件夹(不是drawable文件夹),因为它们用在不同分辨率的设备上。
When referencing the mipmap- folders ensure you are using the following reference:
当引用mipmap文件夹的资源时,需要使用下面的方式:

android:icon="@mipmap/ic_launcher"

结论:
mipmap仅仅用于应用启动图标,可以根据不同分辨率进行优化。其他的图标资源,还是要放到drawable文件夹中。

Android 官方解释[3]:

Note: You should place all launcher icons in the res/mipmap-[density]/ folders, rather than drawable/ folders to ensure launcher apps use the best resolution icon.
注意:你应当将虽有启动图标放到res/mipmap-[density]/文件夹中,而不是drawable/文件夹,来确保启动图片使用最好的分辨率图标。

参考[1]:http://stackoverflow.com/questions/28065267/mipmap-vs-drawable-folders
参考[2]:http://stackoverflow.com/questions/23935810/mipmap-drawables-for-icons
参考[3]:https://developer.android.com/training/multiscreen/screendensities.html

  • 6
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值