jpardogo / FlabbyListView

Android library to display a ListView whose cells are not rigid but flabby and react to ListView scroll.
Apache License 2.0
758 stars 142 forks source link

Invalid Region.Op - only INTERSECT and DIFFERENCE #7

Open Yaque opened 5 years ago

Yaque commented 5 years ago

I use it in android 9.0. something happened Process: com.aiocw.termsinnocent, PID: 5980 java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed at android.graphics.Canvas.checkValidClipOp(Canvas.java:789) at android.graphics.Canvas.clipRect(Canvas.java:836) at com.jpardogo.android.flabbylistview.lib.FlabbyLayout.onDraw(FlabbyLayout.java:59) at android.view.View.draw(View.java:20226) at android.view.View.updateDisplayListIfDirty(View.java:19101) at android.view.View.draw(View.java:19954)

about this erro. FlabbyLayout.java @Override protected void onDraw(final Canvas canvas) { if (mWidth == 0) mWidth = getWidth(); if (mHeight == 0) mHeight = getHeight(); mRect = canvas.getClipBounds(); mRect.inset(0, -mHeight / 2); canvas.clipRect(mRect, Region.Op.REPLACE); float startX1;

use this if(Build.VERSION.SDK_INT >= 28){ canvas.clipPath(mPath0); }else { canvas.clipPath(mPath0, Region.Op.XOR); } to replace

could you fix this problem?