您的位置:首页 > 移动开发 > Android开发

ava.lang.IllegalStateException The specified child already has a parent. You must call removeView()

2016-03-16 15:20 393 查看
在使用viewpage+fragment的时候报如下错误信息:

ava.lang.IllegalStateException The specified child already has a parent. You must call removeView()。

只需在onCreateView方法中返回inflater.inflate(R.layout.im_contacts_activity, container,false)即可。

如果使用的是TabFragment
则下面此方法一起使用:

@Override
protected int getLayoutId() {
return R.layout.im_contacts_activity;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
return inflater.inflate(R.layout.im_contacts_activity, container,
false);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android