如何在屏幕中央创建一个透明的曲线矩形?
我已经编写了以下代码,并为屏幕中央的曲线矩形添加了alpha值,但是背景颜色显示出来而不是透明。
我已经编写了以下代码,并为屏幕中央的曲线矩形添加了alpha值,但是背景颜色显示出来而不是透明。
int width = canvas.getWidth();
int height = canvas.getHeight();
Rect childRect = this.getChildRect();
Paint outerPaint = new Paint();
outerPaint.setColor(Color.LTGRAY);
borderPaint.setStyle(Paint.Style.FILL);
Paint innerPaint = new Paint();
innerPaint.setARGB(0, 0, 0, 0);
innerPaint.setAlpha(0);
innerPaint.setStyle(Paint.Style.FILL);
canvas.drawRect(0.0F, 0.0F, width, height, outerPaint);
canvas.drawRoundRect(new RectF(childRect.left, childRect.top, childRect.right, childRect.bottom), 8F, 8F, innerPaint);