Android The specified child already has a parent.解决方法

来源:互联网 发布:java邮箱格式验证方法 编辑:程序博客网 时间:2024/05/16 02:55

  当遇到这个错误的时候,我们可以采用下面的方法去解决:

java.lang.IllegalStateException: The specified child already has a parent.You must call removeView() on the child's parent first.

  解决方法:

ViewGroup parent = (ViewGroup) view.getParent();if (parent != null) {    parent.removeAllViews();}
0 0
原创粉丝点击