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

androidbitmapbitmaskimage processing

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….

Best Answer

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));