【发布时间】:2011-11-18 07:22:27
【问题描述】:
我尝试修改 Paint 变量,但没有成功 - 如何使位图显示为“半透明”?
【问题讨论】:
标签: android bitmap transparency
我尝试修改 Paint 变量,但没有成功 - 如何使位图显示为“半透明”?
【问题讨论】:
标签: android bitmap transparency
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);
【讨论】:
Paint p = new Paint();
p.setAlpha(70);
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.wallpaper);
canvas.drawBitmap(image, xPosition, yPosition, p);
【讨论】: