The specified child already has a parent. You must call removeView() on the child's parent first.
来源:互联网 发布:百度软件管家官方下载 编辑:程序博客网 时间:2024/06/14 23:13
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
以上问题是由于布局文件已经有了父视图,再次加载会出现重复,导致错误,去除窗体的原始父窗体就可以了。
1. 遇到问题是在fragment中,当获取view的时候报错了,示例为
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
return inflater.inflate(R.layout.slidingdrawer, container, false);
}
最后一个参数没有写,默认为true,代表依附于ViewGroup,这样布局就有了父窗体,再次添加到其他view里面就会报错,所以应该写上false,问题解决。
文章来自:http://blog.163.com/zzf_soft/blog/static/1340017472013111804322552/
0 0
- The specified child already has a parent. You must call removeView() on the child's parent first.
- 二、The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first
- The specified child already has a parent. You must call removeView() on the child's parent first
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first
- The specified child already has a parent. You must call removeView() on the child's parent first.
- 总是报The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.解决办
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first
- The specified child already has a parent. You must call removeView() on the child's parent first.问解决
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.
- The specified child already has a parent. You must call removeView() on the child's parent first.
- JavaScript 模拟类(class)的三种方法
- C语言学习之关键字第七讲
- 4395: [Usaco2015 dec]Switching on the Lights|暴力
- p3p协议实现跨域站点登录
- Activity设置全屏显示的两种方式及系统自带theme属性解析
- The specified child already has a parent. You must call removeView() on the child's parent first.
- 起步,Python+Flask记录
- QWebView linkClicked()信号
- 2016【太原网络营销师】郭文军何为社会化媒体的http理论
- 自定义View中,获取string字符串的宽高
- Android网络开发框架Retrofit(五:实战篇,实现MVP模式进行开发)
- 程序猿学习新技术的10个建议
- 怎样在Android项目中在一个数据库里建立多张表
- TextView使用完全讲解