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

Fragment在框架中的使用,ButterKnife的绑定 #174

Closed
Sum41forever opened this issue Jan 3, 2018 · 1 comment
Closed

Fragment在框架中的使用,ButterKnife的绑定 #174

Sum41forever opened this issue Jan 3, 2018 · 1 comment

Comments

@Sum41forever
Copy link
Contributor

Sum41forever commented Jan 3, 2018

注意,注意,注意:ActivityLifecycleCallbacks 里的方法是在 Activity 对应生命周期的 super() 方法中进行的。 FragmentLifecycleCallbacks 里的方法是在 Fragment 对应生命周期方法全部执行完毕后后调用的。

Fragment在框架中的使用

Fragment的初始化时在ActivityLifecycleOncreate()中,通过 IActivity接口的useFragment()方法设置是否使用注册回掉监听

image
image


ButterKnife在Fragment中的绑定

问题:为什么框架里的BaseActivity提供了通用的ButterKnife绑定,而BaseFragment没有提供?
回答:框架对Fragment提供了ButterKnife绑定,不过和BaseActivity以基类的形式绑定不同,Frament中对ButterKnife绑定是通过注册回掉的形式绑定的。

image
image
image

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