Android开发随身笔记

来源:互联网 发布:淘宝店铺公告栏 编辑:程序博客网 时间:2024/06/03 02:29

今天在开发app时发现自己项目里的图片放的太过随意了,在mipmap 和drawable 里都放了许多图片,感觉不对劲的我赶紧上官网查了


下面是引用自 google 官方的描述:

Mipmapping for drawables 
Using a mipmap as the source for your bitmap or drawable is a simple way to provide a quality image and various image scales, which can be particularly useful if you expect your image to be scaled during an animation. 
Android 4.2 (API level 17) added support for mipmaps in the Bitmap class—Android swaps the mip images in your Bitmap when you’ve supplied a mipmap source and have enabled setHasMipMap(). Now in Android 4.3, you can enable mipmaps for a BitmapDrawable object as well, by providing a mipmap asset and setting the android:mipMap attribute in a bitmap resource file or by calling hasMipMap().

一句话总结就是google 建议大家只把 app 的启动图标放在 mipmap 目录中,其他图片资源仍然放在 drawable 下面。

也就是说一些icon图标之类的东西可以放在mipmap里面,其它的还是放在drawable 下面好