当前位置: 代码迷 >> Android >> android cliprect not work in high version
  详细解决方案

android cliprect not work in high version

热度:443   发布时间:2016-04-28 05:02:48.0
android cliprect not work in high version.
i have a problem with a custom view with running on api 15 (Android 4.0.3)

the code:

canvas.clipRect(10,10,100,100, Region.Op.DIFFERENCE);
canvas.drawPaint(myPaint);
fills the full area of the view and not just the DIFFERENCE... it works with api 8 and 9...


XOR, Difference and ReverseDifference clip modes are ignored by ICS if hardware acceleration is enabled.

Just disable 2D hardware acceleration in your view:

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  相关解决方案