Android中Bitmap, Drawable, Byte,ID之间的转化
来源:互联网 发布:网上挂号预约软件 编辑:程序博客网 时间:2024/04/30 13:56
- Bitmap 转化为 byte
ByteArrayOutputStream out = new ByteArrayOutputStream();bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);byte[] array= out.toByteArray();
- byte转化为bitmap
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
- bitmap转化为Drawable
Drawable drawable = new FastBitmapDrawable(bitmap);
- Drawable转化为bitmap
a. BitmapDrawable, FastBitmapDrawable直接用getBitmap
b. 其他类型的Drawable用Canvas画到一个bitmap上
Canvas canvas = new Canvas(bitmap) drawable.draw(canvas)
5.id转化graphic.drawable
Drawable drawable = 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之间的转化
- Hbase_shell底层源码乱砍乱伐--59
- windows8 安装教程
- 获取手机存储空间信息
- SpringMVC-Mybatis 个人总结
- 进程间通信(IPC)之共享内存
- Android中Bitmap, Drawable, Byte,ID之间的转化
- Hbase事例基本方法--60
- Nginx
- 用IDEA追忆一下童年
- Android 按钮事件两种经典写法
- 面向对象和面向过程
- C 语言的运算符表达式 if switch while
- BaseAdapter的用法
- Mac OS X 系统配置 Apache+MySql+PHP 详细教程