fragment The specified child already has a parent. You must call removeView()

在切换Fragment的时候出现:The specified child already has a parent. You must call removeView()异常。

错误主要出在Fragment中的oncreateview方法中。

可能引起错误的写法:

View view = inflater.inflate(R.layout.indexfragment_layout, container);

  正确写法:

View view = inflater.inflate(R.layout.indexfragment_layout, container,
				false);

  具体原因暂不详,希望知道的同学告知一下,谢谢。

posted on 2015-04-10 15:59  飘杨......  阅读(402)  评论(0编辑  收藏  举报