异常原文:
java.lang.IllegalStateException The specified child already has a parent. You must call removeView() on the child's parent first
原理分析:
解决方法:
在 fragment 的 onCreateView 中 的 inflate 方法,检查是否有一个false参数,没有的话添上。
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_vagetablemarket, container, false); return rootView; }
转载必须注明来源: 小树技术博客 » 关于异常“The specified child already has a parent”的解决