Android-VieW-Canvas-bitmap

所属分类:android开发
开发工具:Java
文件大小:53KB
下载次数:30
上传日期:2012-04-12 21:44:59
上 传 者netwalk
说明:  BitMap、View以及Canvas是我们Ophone程序中常用到的类。本日以feisky的学习笔记呈现,通过实例讲解View&Canvas等等。 1. 从资源中获取位图 可以使用BitmapDrawable或者BitmapFactory来获取资源中的位图。 当然,首先需要获取资源: Resources res=getResources() 使用BitmapDrawable获取位图 使用BitmapDrawable (InputStream is)构造一个BitmapDrawable; 使用BitmapDrawable类的getBitmap()获取得到位图; // 读取InputStream并得到位图 InputStream is=res.openRawResource(R.drawable.pic180) BitmapDrawable bmpDraw=new BitmapDrawable(is) Bitmap bmp=bmpDraw.getBitmap() 或者采用下面的方式:
(BitMap, View and Canvas is we use class often Ophone program. This day to feisky study notes appear, through the examples explain View&Canvas and so on. 1. Get a bitmap from resources Can use BitmapDrawable or BitmapFactory to obtain resources of the bitmap. Of course, we first need to obtain resources: Resources res = getResources () Use BitmapDrawable get a bitmap Use BitmapDrawable (InputStream is constructing a BitmapDrawable Use BitmapDrawable kind getBitmap () get get a bitmap //read InputStream and get a bitmap InputStream is = res. OpenRawResource (R.d rawable. Pic180) BitmapDrawable bmpDraw = new BitmapDrawable (is) Bitmap BMP = bmpDraw. GetBitmap () Or use the following ways: )

文件列表:
Android开发者学习笔记——View、Canvas、bitmap.doc (81920, 2011-09-15)

近期下载者

相关文件


收藏者