Skip to content
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

addView、removeView #38

Closed
SamanLan opened this issue Oct 8, 2017 · 3 comments
Closed

addView、removeView #38

SamanLan opened this issue Oct 8, 2017 · 3 comments

Comments

@SamanLan
Copy link

SamanLan commented Oct 8, 2017

@LoadSirUtil#getTargetContext

if (contentParent != null) {
            contentParent.removeView(oldContent);
        }
        return new TargetContext(context, contentParent, oldContent, childIndex);

rt
用add以及remove 真正的View真的好吗,这两个操作涉及比较多东西(比如测量)
尝试visible?
but
这种方式(尝试visible)的话,childView的index就相对于开发者本身是不可知的操作了(因为变化了),应该权衡一下

@SamanLan
Copy link
Author

SamanLan commented Oct 8, 2017

补一个
可以的话
请去除清单的
android:allowBackup="true"
android:label="LoadSir"

@KingJA
Copy link
Owner

KingJA commented Oct 9, 2017

@SamanLan 你好
1.你提出的contentParent的remove和add只在注册的时候进行一次。相当于用LoadLayout替换掉了老的布局。以后所有的布局切换都会是在LoadLayout上发生。下个版本LoadLayout上我可能不再remove SuccessView了,SuccessView会根据需求VISIBLE或GONE,其它的回调页布局暂时还是会采用add和remove方式。add操作是不可避免的,区别的是remove或者GONE。如果你有更好的方法,欢饮交流。
2.android:label="LoadSir"是为了去掉Library的res文件夹的补救措施。保留res会带来一些API版本的兼容问题。
感谢你的建议。:neckbeard:

@SamanLan
Copy link
Author

SamanLan commented Oct 9, 2017

早上好
假如连第一次的替换都能节省掉那就最好了。
good job

@SamanLan SamanLan closed this as completed Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants