Android中minmap和drawable的区别
来源:互联网 发布:牛的照片 比较好 知乎 编辑:程序博客网 时间:2024/05/26 12:59
Android 在 API level 17 加入了 mipmap 技术,对 bitmap 图片的渲染支持 mipmap 技术,来提高渲染的速度和质量。
mipmap 是一种很早就有的技术了,翻译过来就是纹理映射技术。android 中的 mipmap 技术主要为了应对图片大小缩放的处理,在android 中我们提供一个 bitmap 图片,由于应用的需要(比如缩放动画),可能对这个 bitmap 进行各种比例的缩小,为了提高缩小的速度和图片的质量,android 通过 mipmap 技术提前对按缩小层级生成图片预先存储在内存中,这样就提高了图片渲染的速度和质量。
api 中通过 Bitmap 的 public final void setHasMipMap (boolean hasMipMap) 方法可以让系统渲染器尝试开启 Bitmap 的 mipmap 技术。但是这个方法只能建议系统开启这个功能,至于是否正真开启,还是由系统决定。
res 目录下面 mipmap 和 drawable 的区别也就是上面这个设置是否开启的区别。mipmap 目录下的图片默认 setHasMipMap 为 true,drawable 默认 setHasMipMap 为 false。
google 建议大家只把 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().
参考:
android reference bitmap
- Android中minmap和drawable的区别
- Android中mipmap 和 drawable 的区别
- android 中Drawable、Bitmap、Canvas和Paint的区别
- Android中dpi、drawable和VGA的区别以及联系
- Android开发中Bitmap和Drawable的区别
- Android中Drawable和Bitmap的区别及互相转化
- android中drawable bitmap canvas paint的转换和区别
- Android开发中Bitmap和Drawable的区别
- Android中mipmap和drawable文件夹的区别
- android中drawable 与mipmap的区别
- android studio mipmap 和drawable的区别
- Android mipmap 和 drawable 文件夹的区别
- Android mipmap和drawable的区别
- android Bitmap和Drawable的区别
- Android mipmap 和 drawable 的区别
- android中bitmap和drawable的转换
- Android中Bitmap和Drawable的转换
- drawable-xhdpi和drawable-xxxhdpi的区别
- Android支付sdk开发流程
- hello
- 智能指针(一):STL auto_ptr实现原理
- Qt报Multiple definition错误的解决
- Windows server 2012 R2开机进入cmd,关闭后黑屏问题。
- Android中minmap和drawable的区别
- 中国数字备录
- 想做 C++ 方面开发,是基于 Linux 还是基于 Windows 平台?
- 176. Second Highest Salary--MAX,UNION,LIMIT
- 运算符重载++
- 在delphi中限制Form大小的实现方法
- web.xml 中的listener、 filter、servlet 加载顺序及其详解
- 代码中发送http请求, java.lang.IllegalArgumentException: Illegal character in query at index...,非法字符错误解决办法
- Ubuntu快捷键