IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed 解决办法
Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed 解决办法
将 destCanvas.clipRect(clipRect, Region.Op.REPLACE);替换为以下代码:
if(Build.VERSION.SDK_INT >= 26){
destCanvas.clipRect(clipRect);
}else {
destCanvas.clipRect(clipRect, Region.Op.REPLACE);
}
异常log:
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
at android.graphics.Canvas.clipRect(Canvas.java:826)
at com.android.launcher2.Workspace.drawDragView(Workspace.java:1796)
at com.android.launcher2.Workspace.createDragOutline(Workspace.java:1840)
at com.android.launcher2.Workspace.startDrag(Workspace.java:1893)
at com.android.launcher2.Launcher.onLongClick(Launcher.java:2473)
at android.view.View.performLongClickInternal(View.java:6677)
at android.view.View.performLongClick(View.java:6635)
at com.android.launcher2.CheckLongPressHelper$CheckForLongPress.run(CheckLongPressHelper.java:30)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)