Reputation: 1609
I am creating Bitmap
using following code:
Bitmap bm= Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
But I want to change Background
color from black to transparent because I want to use this object in another Activity
also. I searched a lot but I am unable to find solution.
Please help.
Thanks in advance.
Upvotes: 7
Views: 15602
Reputation: 371
Of course the Bitmap created in mode ARGB_8888 supports transparency But the alpha channel is initially filled by 0xff, so bitmap is opaque. You have to clear the whole bitmap including the alpha channel like this:
Canvas c = new Canvas(bm);
c.drawColor(0, Mode.CLEAR);
Upvotes: 13
Reputation: 5881
Bitmap images do not support transparency. You should use a GIF or a PNG.
http://www.gimpchat.com/viewtopic.php?f=8&t=1290
Upvotes: -1