使用 Canvas clipPath 时出现 UnsupportedOperationException。
这发生在 HTC Sensation XE (4.0.3) 上。它可以在其他 4.0.3 设备上完美运行。
这是代码:
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save();
canvas.clipPath(this._mClip);
super.dispatchDraw(canvas);
canvas.restore();
}
它在“clipPath”上失败,堆栈如下:
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)