Android中Bitmap, Drawable, Byte,ID之间的转化
来源:互联网 发布:上瘾网络剧见面会视频 编辑:程序博客网 时间:2024/04/30 23:46
1. Bitmap 转化为 byte
ByteArrayOutputStream out = newByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG,100, out);
byte[] array= out.toByteArray();
2.byte转化为bitmap
Bitmap bitmap =BitmapFactory.decodeByteArray(data, 0, data.length);
3.bitmap转化为Drawable
Drawable drawable = newFastBitmapDrawable(bitmap);
4.Drawable转化为bitmap
a. BitmapDrawable, FastBitmapDrawable直接用getBitmap
b. 其他类型的Drawable用Canvas画到一个bitmap上
Canvas canvas = new Canvas(bitmap)
drawable.draw(canvas)
5.id转化graphic.drawable
Drawable drawable =activity.getResources().getDrawable(R.drawable.icon);
6.id转化成Bitmap
Bitmap bitmap = BitmapFactory. decodeResource (Resources res, int id);
0 0
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Android中Bitmap, Drawable, Byte,ID之间的转化
- android-Bitmap, Drawable, Byte之间的转化
- Android中Bitmap, Drawable, Byte之间的转化
- Android中Bitmap, Drawable, Byte之间的转化
- 用Python让树莓派“说话”
- 版本控制系统概述
- 鼠标悬浮时菜单效果
- 标准库vector类型简介
- mobiscroll 触屏日期插件
- Android中Bitmap, Drawable, Byte,ID之间的转化
- 关于读取工程根目录下的文件的方法
- 在Mac中显示隐藏文件
- linux平台总线驱动设备模型之点亮LED
- Vmware虚拟机进入BIOS方法
- 帝国cms选取两个表的集合,按某字段排序
- 0020 Java中equals()和hashCode()详解【基础】
- XAMPP下的phpMyAdmin默认登陆不需要验证的解决方法
- K60的计时器/定时器的简单介绍