Issue
I'm using the Universal Image Loader for Android (here is the link)
I need to to load an Image from a URL and overlay it to another image. The library can not do it by default, so I'm try to change it. The problem is that now I need to convert a LayerDrawable to Bitmap. How can I do that?
Solution
Just draw it on a Canvas which is backed by a Bitmap.
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
Answered By - P Varga
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.