android - addView() 之后的 "resultIndex is -1, the polygon must be invalid!"

标签 android android-view

在 ViewGroup (FrameLayout) 上调用 addView() 方法后出现异常。

public final View createView(Context context, Property property, ViewGroup parent) {
        mView = LayoutInflater.from(context).inflate(getLayout(), null);
        mContext = context;
        mProperty = property;
        processBaseViews(mView, property);
        processViews(mView, property);
        parent.addView(mView);
        return mView;
    }

异常(exception):

10-17 18:39:40.060: E/OpenGLRenderer(511): resultIndex is -1, the polygon must be invalid!
10-17 18:39:40.061: A/libc(511): Fatal signal 7 (SIGBUS), code 1, fault addr 0x136 in tid 726 (hwuiTask1)

此代码在 Android Lollipop (SDK <= 22) 上正常运行,但在 Android Marshmallow (SDK 23) 上因错误而关闭。我怎么解决这个问题?

最佳答案

我收到同样的错误也是同样的情况,代码在 api<23 中工作正常仅在 api 23 上崩溃 我在我的代码中发现我在替换之前将自定义动画设置为 fragment 。这是我的代码 fragment

    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.fragment_container, fragment);
    transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    transaction.commit();

关于android - addView() 之后的 "resultIndex is -1, the polygon must be invalid!",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33188485/

相关文章:

android - 在添加之前或之后设置 fragment 内容?

android - 在 ubuntu 10.04 x86-64 上构建 android 系统时出现内部编译器错误

Android 安全异常 : package is frozen

android - 使用图像作为导航菜单抽屉菜单中的项目

android - java.lang.StackOverFlow 错误。怀疑浏览量过多?

java - 在 xml 中为 Android 中的自定义 View 设置 onClick 在某些版本上不起作用

android - 自定义 Listview 在滚动 android 时非常滞后

android - 在 Android 主屏幕小部件中可以使用 Thread 而不是 Service 吗?

android - 无法在 onDraw 内部调用 removeOnDrawListener

java - 如何获取动态创建的textview的id?