在 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/