Подтвердить что ты не робот

Android как рисовать растровое изображение на полупрозрачном холсте

Я попытался изменить переменную Paint, но не увенчался успехом - как сделать растровое изображение "полупрозрачным"?

4b9b3361

Ответ 1

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

Ответ 2

Paint p = new Paint();
p.setAlpha(70);

Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.wallpaper);
canvas.drawBitmap(image, xPosition, yPosition, p);