gpt4 book ai didi

android - clipPath 上的 UnsupportedOperationException

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:50:32 25 4
gpt4 key购买 nike

我在使用 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)

最佳答案

您可以通过编辑 list 文件来控制单个 Activity 的硬件加速

<application android:hardwareAccelerated="true">
<activity ... />
<activity android:hardwareAccelerated="false" />

关于android - clipPath 上的 UnsupportedOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13248904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com