Home > Blockchain >  Make the background transparent on the android canvas
Make the background transparent on the android canvas

Time:11-15

How to Make transparent background on canvas android.?

I want to make a transparent background like this (see picture), does this kind of background use a bitmap?

background like pixels

CodePudding user response:

Use a PNG format image, and set the alpha layer for transparency. What image tool are you using? Tools like GIMP & photoshop has this built in, IIRC right click the background layer (or the bottom layer if you have renamed it) and its there on the context menu.

Thats if your using a background.png in your app/main/res/drawable - or are you constructing the background purely in code?

CodePudding user response:

you can, create bitmap ARGB_8888,

  val bitmap  = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888)
    val canvas = Canvas(bitmap)
    canvas.drawColor(Color.TRANSPARENT)
  • Related