I have tried to modify a Paint variable, but have been unsuccessful - how can I make a bitmap appear "semi-transparent"?
Asked
Active
Viewed 2.0k times
2 Answers
50
canvas.drawColor(Color.WHITE);
BitmapDrawable bd = (BitmapDrawable) getResources().getDrawable(R.drawable.loading);
Bitmap bm = bd.getBitmap();
Paint paint = new Paint();
paint.setAlpha(60); //you can set your transparent value here
canvas.drawBitmap(bm, 0, 0, paint);
-
Works perfect also in kotlin! – iluxa.b Feb 20 '20 at 19:34