Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
出现这种错误一般都是,往一个父View里面重复添加了同一个view,找到重复的,删掉即可。有重复添加需要的,需要重新生成一个View。或者把前一个remove掉。
本文介绍了如何解决在Android开发中遇到的'Causedby:java.lang.IllegalStateException:Thespecifiedchildalreadyhasaparent.'错误。该错误通常发生在试图将同一个子View重复添加到父View时。解决方案包括检查并删除重复的子View,或在添加前移除已存在的子View。
Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
出现这种错误一般都是,往一个父View里面重复添加了同一个view,找到重复的,删掉即可。有重复添加需要的,需要重新生成一个View。或者把前一个remove掉。
2747
1112
17万+
203
2万+
1119
453
198
1294
820

被折叠的 条评论
为什么被折叠?