标签:android
/*Java代码 将Drawable转化为Bitmap */ Bitmap drawableToBitmap(Drawable drawable) { int width = drawable.getIntrinsicWidth(); int height = drawable.getIntrinsicHeight(); Bitmap bitmap = Bitmap.createBitmap(width, height,drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888: Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); //canvas.drawColor(0xff33B5E5); drawable.setBounds(0,0,width,height); drawable.draw(canvas); return bitmap; }
标签:android
原文地址:http://blog.csdn.net/zhangphil/article/details/43767535