与Canvas.clipPath Android 4.0的兼容性问题 [英] Android 4.0 compatibility issues with Canvas.clipPath

查看:592
本文介绍了与Canvas.clipPath Android 4.0的兼容性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

近日收到我的申请相当多的评论说,它不工作在Android冰淇淋三明治CM9。我不能重现错误上运行的Andr​​oid 4.0和感谢的方式Android Market的仿真器的工作原理没有办法,我联系不上那些人询问有关细节。

Recently my application received quite a lot comments that "it's not working" on Android Ice Cream Sandwich with CM9. I'm not able to reproduce the error on the emulator running Android 4.0 and thanks to the way android market works there's no way I can't contact those people to ask about the details.

幸运的是,一次碰撞错误报告吸引了我的眼球。我使用 Canvas.clipPath 绘制圆角......,看起来像一些手机都扔 UnsupportedOperationException异常尝试时,使用该功能。快看看谷歌发现,它似乎是使用硬件加速的Andr​​oid 4.0时,一个问题 - 所以这是收到的意见的潜在原因

Luckily, one crash error report caught my eye. I'm using Canvas.clipPath to draw rounded corners... and looks like some phones are throwing UnsupportedOperationException when trying to use that function. Quick look at Google reveals that it seems to be a problem when using hardware acceleration in Android 4.0 - so that's the potential reason of received comments.

现在的问题是 - 这是怎么回事?在previous的Andr​​oid版本并没有应用程序的硬件加速?为什么不支持这样的共同作用?有什么解决办法?

The question is - what's going on? Weren't applications hardware accelerated in previous android versions? Why such common function isn't supported? What's the workaround?

Canvas.clipPath使用示例可以在我的其他职位被发现。在这里检查的接受的答案:的Andr​​oid圆润的边角的ListView

Example usage of Canvas.clipPath can be found in my other post. Check the accepted answer here: Android rounded corners in ListView

在此先感谢

推荐答案

在ICS,硬件加速是默认打开的。直到4.0,默认的是,硬件加速是关闭的。 硬件加速不支持clipPath(和一些其他的操作,多看这里<一href="http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html">http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html) 我面临着同样的问题。作为一个快速解决,我会关掉加速整个应用程序,后来我将改写code不使用clipPath

In ICS, hardware acceleration was turned on by default. Until 4.0, the default was that hardware acceleration was off. Hardware acceleration does not support clipPath (and a few other operations, see more here http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html) I am facing the same issue. As a quick fix I will turn off acceleration for the entire application, and later I will rewrite the code not to use clipPath

这篇关于与Canvas.clipPath Android 4.0的兼容性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆