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
xO@{au  *7*ݵioE q  %9&/++D`$ 뾟sהMTUpFZ:7L69,{S+%jѭ=k,D# &#Pƒ=)9B,rG<NGy D4kXCE*آI  +UdtCȰ1R@9 ٜ 5s T 2 `㬙wt< ʏ /:`H JhDFvef΂HU}l~&1)./JXy)ɱ*992m Do(}7јpFVX"Er!4lf-;hC6E()$b4.1 ޕ~  ĩ7GrU'Z?K18`GHpJR=t볬QdBD{K6n);ȝlv=_J HSRvkoRZ*Mrv֋ƴ vzgq6[V\}6N_~iP<*b\obR+)iL^ga1Mu) GwYiVLzYfoo.X-ԸGmBkt;{U5o97o

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本身就有错