Region.Op.XOR被Region.Op.DIFFERENCE代替
所以在大于28的高版本 canvas.clipPath(mPath0, Region.Op.XOR)被 canvas.clipOutPath(mPath0)取代, canvas.clipPath(mPath1, Region.Op.INTERSECT)被canvas.clipPath(mPath1)取代
可以看源码 canvas.clipOutPath正是调用了clipPath(path, Region.Op.DIFFERENCE),而canvas.clipPath调用了canvas.clipPath(path, Region.Op.INTERSECT)
类似于这样
if(Build.VERSION.SDK_INT >= 28){
canvas.clipOutPath(mPath0);
canvas.clipPath(mPath1);
else {
canvas.clipPath(mPath0, Region.Op.XOR);
canvas.clipPath(mPath1, Region.Op.INTERSECT);
}
参考:
https://github.com/newbiechen1024/NovelReader/issues/82
https://github.com/newbiechen1024/NovelReader/issues/66