protected void onDraw(Canvas canvas) {
float width = canvas.getWidth();
float height = canvas.getHeight();
Path path = new Path();
path.addArc(new RectF(0, 0, width, height), 90, 180);
canvas.clipPath(path);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(Color.RED);
canvas.drawRect(new RectF(0, 0, width, height), paint);
}
我使用此代码覆盖其他视图;没关系(显示半圆形); 但是当我用它来覆盖FrameLayout时,给我看一个矩形?!
为什么呢? 我该如何修改它?