Android: Howto use clipRect in API15

岁酱吖の 提交于 2019-12-28 18:06:13

问题


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...

Thanks for your help


回答1:


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);


来源:https://stackoverflow.com/questions/9191083/android-howto-use-cliprect-in-api15

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!