实现效果如下图
实现方法:
1.计算镂空区域的坐标
2.新建一张canvas,绘制半透明蒙版
3.将PorterDuffXfermode设为Clear
4.绘制镂空区域到canvas
具体见代码:
设置要镂空的view:
public void setTarget(View v) {
mTragetView = v;
}
计算镂空区域的坐标:
int[] location = new int[2];
mTragetView.getLocationInWindow(location);
mRectStartPoints = new Point(location[0], location[1]);