本文介绍了clipPath上的UnsupportedOperationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Canvas clipPath时出现UnsupportedOperationException.

I am getting an UnsupportedOperationException when using Canvas clipPath.

这是在HTC Sensation XE(4.0.3)上发生的.它可以在其他4.0.3设备上完美运行.

This is happening on an HTC Sensation XE (4.0.3).It works perfectly on other 4.0.3 devices.

这是代码:

    @Override
protected void dispatchDraw(Canvas canvas) {
    canvas.save();
    canvas.clipPath(this._mClip);
    super.dispatchDraw(canvas);
    canvas.restore();
}

它在具有以下堆栈的"clipPath"上失败:

It fails on the "clipPath" with the following stack:

11-06 12:05:53.650: E/AndroidRuntime(25021): FATAL EXCEPTION: main

11-06 12:05:53.650: E/AndroidRuntime(25021): java.lang.UnsupportedOperationException
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.GLES20Canvas.clipPath(GLES20Canvas.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.applicat.meuchedet.views.RoundedListView.dispatchDraw(RoundedListView.java:76)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.AbsListView.draw(AbsListView.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.ListView.draw(ListView.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.FrameLayout.draw(FrameLayout.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.draw(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.os.Handler.dispatchMessage(Handler.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.os.Looper.loop(Looper.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.app.ActivityThread.main(ActivityThread.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at java.lang.reflect.Method.invokeNative(Native Method)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at java.lang.reflect.Method.invoke(Method.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at dalvik.system.NativeStart.main(Native Method)

推荐答案

此处.简而言之:它不再受支持,但是如果禁用硬件加速,仍然可以使用它.有关更多信息,请参见帖子.

There is an answer here. In short: Its no longer supported but you can still use it if you disable hardware acceleration. See post for more info.

这篇关于clipPath上的UnsupportedOperationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-02 21:22