How to change background color of bitmap to transparent and background should not drag?

sam786 picture sam786 · Nov 3, 2012 · Viewed 13.3k times · Source

I used:

Bitmap bitmap= Bitmap.createBitmap(255, 255, Bitmap.Config.RGB_565); 
Canvas canvas = new Canvas(bitmap); 

Background color is black....

If I use:

Bitmap.Config.ARGB_8888; 

background color is white...

my question is that How to change background color of bitmap to transparent and background should not drag? only center image have to drag...

plz can anybody say this solution or example....

Answer

Barış Çırıka picture Barış Çırıka · Nov 3, 2012

Try to add

Bitmap bitmap= Bitmap.createBitmap(255, 255, Bitmap.Config.ARGB_8888);

after that try this line (A is alpha value interval is 0-255 and 0 is fully transparent).

bitmap.eraseColor(Color.argb(AAA,RRR,GGG,BBB));