The specified child already has a parent. You must call removeView() on the child's parent first.

来源:互联网 发布:农村淘宝店主怎么赚钱 编辑:程序博客网 时间:2024/04/29 11:24

在使用fragmentActivity和fragment时,调用replace时出现Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.错误。


解决办法:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View rootView = inflater.inflate(R.layout.fragment_exchange, container,false);

0 0
原创粉丝点击