I'm trying to change the alpha channel, at the output is the same for different values ​​of alpha.

image = BitmapFactory.decodeResource(context.getResources(), R.drawable.my_image); shinyImage = new BitmapDrawable(context.getResources(),border); shinyImage.setAlpha(0); // Альфа! image = shinyImage.getBitmap(); 

Does anyone understand why?

  • I do not understand what you have written. Why the first line, if you end up with image = shinyImage.getBitmap ()? What is a border? What do you want to get in the end? - rasmisha
  • Are you sure that bitmap has an alpha channel? - Vladyslav Matviienko

1 answer 1

 Bitmap bgr = BitmapFactory.decodeResource(getResources(),R.drawable.logo); Paint transparentpainthack = new Paint(); transparentpainthack.setAlpha(100); canvas.drawBitmap(bgr, 0, 0, transparentpainthack);