First, you should use ARGB_8888... ARGB_4444 is deprecated:
http://developer.android.com/reference/android/graphics/Bitmap.Config.html

Next, here is how to do it:

temp = Bitmap.createBitmap(thisWidth, thisHeight, Config.ARGB_8888);

//Clear the canvas
Canvas canvas = new Canvas(temp);

Paint transPainter = new Paint();
transPainter.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

canvas.DrawRect(0, 0, temp.Width, temp.Height, transPainter);

Hope that helps...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Apr 2, 2012 at 9:54 AM, Perry <[email protected]> wrote:

> hi,
>
> I used following method to create a canvas.
>
> temp = Bitmap.createBitmap(thisWidth, thisHeight, Config.ARGB_4444);
> Canvas thisCanvas = new Canvas(temp);
>
> I don't know why the canvas has a black background. How to create a
> Transparent background for use?
>
> Thanks a lot!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to