Android FragmentTabHost 切换报错,log如下:07-07 17:55:10.523:E/AndroidRuntime(15863):java.lang.IllegalStateException:The specified child already has a parent.You must call removeView() on the child's parent first.07-07 17:55:10.523:E/AndroidRu
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 00:10:17
Android FragmentTabHost 切换报错,log如下:07-07 17:55:10.523:E/AndroidRuntime(15863):java.lang.IllegalStateException:The specified child already has a parent.You must call removeView() on the child's parent first.07-07 17:55:10.523:E/AndroidRu
Android FragmentTabHost 切换报错,log如下:
07-07 17:55:10.523:E/AndroidRuntime(15863):java.lang.IllegalStateException:The specified child already has a parent.You must call removeView() on the child's parent first.
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.view.ViewGroup.addViewInner(ViewGroup.java:3461)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.view.ViewGroup.addView(ViewGroup.java:3332)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.view.ViewGroup.addView(ViewGroup.java:3277)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.view.ViewGroup.addView(ViewGroup.java:3253)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1264)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:672)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
07-07 17:55:10.523:E/AndroidRuntime(15863):\x05at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
Android FragmentTabHost 切换报错,log如下:07-07 17:55:10.523:E/AndroidRuntime(15863):java.lang.IllegalStateException:The specified child already has a parent.You must call removeView() on the child's parent first.07-07 17:55:10.523:E/AndroidRu
关于异常“The specified child already has a parent.You must call removeView"的解决以及产生的原因
这个是因为你在onCreatView()里面,view已经存在,并且有parent了,需要将parent的子view删除就可以了。http://blog.csdn.net/renpengben/article/details/12615487
这个错误 很明显不会是你切换Framgnet的时候报错的 而是你的Fragment本身就有错