-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
动态添加数据刷新控件内容不会再崩溃了 看这。。。 #63
Comments
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. |
现在我项目中都是用的这段代码 没出现java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. |
或者调用的时候直接判断containerView有没有子View 如果有调用)containerView.removeAllViews();应该也是可以的 |
|
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 出现同样的问题,加了以上判断也没用。大概是添加的 子view本身存在父容器吧。比如 SmartRefreshLayout,这种问题该怎么解决。 |
看到这个,终于理解了,我的布局是在xml中,这样的话就很不方便了,看来得换种方式了。 |
动态添加数据刷新控件的时候应该对每个容器进行判断,子控件不为空应该先移除子控件再添加子控件,不然就会出现app闪退崩溃的现象,或者会出现数据叠加显示问题
代码附上:
public void setDropDownMenu(@nonnull List tabTexts, @nonnull List popupViews, @nonnull View contentView) {
The text was updated successfully, but these errors were encountered: