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

setOnLayoutCallback 会执行两次 #62

Open
clj12081103 opened this issue Jun 23, 2017 · 3 comments
Open

setOnLayoutCallback 会执行两次 #62

clj12081103 opened this issue Jun 23, 2017 · 3 comments

Comments

@clj12081103
Copy link

clj12081103 commented Jun 23, 2017

如题

@clj12081103 clj12081103 changed the title fragment中使用报错 java.lang.IllegalArgumentException: parent and child can not be null . Jun 23, 2017
@clj12081103 clj12081103 changed the title “” Jun 23, 2017
@clj12081103 clj12081103 changed the title “” setOnLayoutCallback 会执行两次 Jun 23, 2017
@DuShuYuan
Copy link

同问,怎么解决

@lusongcai
Copy link

.anchor(getActivity().findViewById(R.id.container))//如果是Activity上增加引导层,不需要设置anchor
注释掉就行了

@wxz-wander
Copy link

public HighLight(Context context) {
mContext = context;
mViewRects = new ArrayList<>();
mAnchor = ((Activity) mContext).findViewById(android.R.id.content);
mListenersHandler = new ListenersHandler(this);
registerGlobalLayoutListener();
}

public HighLight anchor(View anchor) {
    mAnchor = anchor;
    registerGlobalLayoutListener();
    return this;
}

在activity使用的时候,构造方法,和anchor都会去注册布局监听,导致会重复注册,所以在acitivty使用引导层,就不设置anchor。同意楼上@lusongcai

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

4 participants