Bitmap与Drawable之间的转换

Bitmap转Drawble


		Resources res=getResources();
		Bitmap bm=BitmapFactory.decodeResource(res, R.drawable.header);
		BitmapDrawable bitmapDrawable = new BitmapDrawable(bm);
		Drawable drawable = (Drawable)bitmapDrawable;

Drawable 转Bitmap:


Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();

© 2011, 冰冻鱼. 请尊重作者劳动成果,复制转载保留本站链接! 应用开发笔记