mipmap和drawable使用

.来看一段话
Here is my two cents in trying to explain the difference. There are two cases you deal with when working with images in Android:
You want to load an image for your device density and you are going to use it “as is”, without changing its actual size.
In this case you should work with drawables and Android will give you the best fitting image.
You want to load an image for your device density, but this image is going to be scaled up or down.
For instance this is needed when you want to show a bigger launcher icon, or you have an animation,
which increases image’s size. In such cases, to ensure best image quality,
you should put your image into mipmap folder. What Android will do is,
it will try to pick up the image from a higher density bucket instead of
scaling it up. This will increase sharpness (quality) of the image.
Thus, the rule of thumb to decide where to put your image into would be:
Launcher icons always go into mipmap folder.
Images, which are often scaled up (or extremely scaled down) and whose quality is critical for the app,
go into mipmap folder as well.
All other images are usual drawables.

.意思就是当图片不需要改变尺寸的时候,图片放drawable,如果图片需要改变尺寸,比如动画里面需要放大,就要放到mipmap,这时候如果图片放到,会自动加载更高尺寸的目录里面的图片,从而避免失真.
一般来说,mipmap仅仅用于应用启动图标,可以根据不同分辨率进行优化。其他的图标资源,还是要放到drawable文件夹中。

.为什么我们应该使用mipmap来启动应用程序启动器图标?

设备具有不同的分辨率,所以启动器应用程序显示不同分辨率的图标。资源优化技术有时会为未使用的屏幕密度移除资源,并且当启动器应用程序必须升级显示器的较低分辨率图标时,它可能看起来模糊不清。为了避免这个问题,应用程序应该为应用程序启动器图标使用mipmap可绘制文件夹。在Android系统从未条这一资源,并确保启动应用程序可以选择与显示器的最佳分辨率的图标。

它可以确保启动器应用程序通过将启动器图标的所有密度移动到密度特定的res / mipmap /文件夹(例如res / mipmap-mdpi /和res / mipmap-xxxhdpi /)来为您的应用程序显示高分辨率图标。应用程序使用mipmap /文件夹代替启动图标的可绘制/文件夹。对于xxhpdi启动器图标,请务必添加更高分辨率的xxxhdpi版本的图标,以增强高分辨率设备上图标的视觉体验。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值