Android Studio中mipmap目录和drawable目录有什么区别
2015-08-31 16:18
507 查看
使用Android Studio开发时发现有2个目录可以放置图片: mipmap vs drawable,那么他们有什么区别呢?该选择哪个呢?
这里网罗各位大神的答案,共同学习:
答案1:
图片还是放在drawable文件夹下吧,mipmap只放launcher icons就好了。
Google官方有介绍:Managing
Projects Overview
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
答案2:
Mipmaps早在Android2.2+就可以用了,但是直到4.3 google才强烈建议使用。把图片放到mipmaps可以提高系统渲染图片的速度,提高图片质量,减少GPU压力。so,do it
答案3:
我也想问这个问题。。。
经过我的研究,我认为 mipmap 支持多尺度缩放效果很好,比如一个 200*200 的图片缩放,如果我们使用 mipmap 那么系统会根据当前缩放范围选择 mipmap 里面恰当的图片,而不是想 drawable 目录下是根据当前设备的屏幕密度选择恰当的图片。如果一个
imageview 有缩放动画,使用 drawable 下的图片,会一直使用一张,来缩放图片实现 imageview 缩放动画,如果使用 mipmap 会根据缩放程度自动选择比当前分辨率大而又最接近当前分辨率的图片来做缩放处理,这样就实现了 google 官方文档中描述的更好视觉效果,更高效率的目的。这也和 mipmap 这个技术的本身含义吻合,除非 google 乱取名字。而 google 文档里面说 laucher icon 使用 mipmap 我认为是因为 laucher icon 在 laucher
app 里面可能有动画,或者有的 laucher app 使用的 laucher icon 分辨率比 google 规定的大,导致使用 drawable 下面的图片会放大,而显示效果不好。
总结:
保守点跟着官方文档走:普通图片放drawable,icon图标放mipmap。既然mipmap自适应缩放效果好,那就把一些动画的图片也放进去吧。
这里网罗各位大神的答案,共同学习:
答案1:
图片还是放在drawable文件夹下吧,mipmap只放launcher icons就好了。
Google官方有介绍:Managing
Projects Overview
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
答案2:
Mipmaps早在Android2.2+就可以用了,但是直到4.3 google才强烈建议使用。把图片放到mipmaps可以提高系统渲染图片的速度,提高图片质量,减少GPU压力。so,do it
答案3:
我也想问这个问题。。。
经过我的研究,我认为 mipmap 支持多尺度缩放效果很好,比如一个 200*200 的图片缩放,如果我们使用 mipmap 那么系统会根据当前缩放范围选择 mipmap 里面恰当的图片,而不是想 drawable 目录下是根据当前设备的屏幕密度选择恰当的图片。如果一个
imageview 有缩放动画,使用 drawable 下的图片,会一直使用一张,来缩放图片实现 imageview 缩放动画,如果使用 mipmap 会根据缩放程度自动选择比当前分辨率大而又最接近当前分辨率的图片来做缩放处理,这样就实现了 google 官方文档中描述的更好视觉效果,更高效率的目的。这也和 mipmap 这个技术的本身含义吻合,除非 google 乱取名字。而 google 文档里面说 laucher icon 使用 mipmap 我认为是因为 laucher icon 在 laucher
app 里面可能有动画,或者有的 laucher app 使用的 laucher icon 分辨率比 google 规定的大,导致使用 drawable 下面的图片会放大,而显示效果不好。
总结:
保守点跟着官方文档走:普通图片放drawable,icon图标放mipmap。既然mipmap自适应缩放效果好,那就把一些动画的图片也放进去吧。
相关文章推荐
- 浅谈Android Fragment嵌套使用存在的一些BUG以及解决方法
- Android学习笔记---SQLite数据库 api
- Android soap请求和解析
- Android Studio 快捷键
- Android动画之translate(位移动画)
- Android源码分析---系统开机流程
- android平台程序崩溃的类型及原因列举
- Android动画 fillAfter和fillBefore
- Android动画学习Demo(3) 沿着贝塞尔曲线移动的Property Animation
- Android下binary级的一些分析调试方法
- Android打造不一样的EmptyView
- Android上积累代码
- Android Studio解除65K限制
- 使用Ant打包Android应用——apk生成过程
- Android应用性能优化之使用SparseArray替代HashMap
- Android基础入门教程——5.2.4 Fragment实例精讲——底部导航栏+ViewPager滑动切换页面
- Android实现仿QQ登录可编辑下拉菜单
- Android连接指定Wifi的Demo
- Android-调用本地方法计算int数值相加结果显示在界面上/NDK-JNI开发实例(三)
- 关于datebase,cursor的一些异常 android.database.CursorWindowAllocationException: Cursor window allocation of