-
Notifications
You must be signed in to change notification settings - Fork 653
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
是否需要在BaseFragment 的 ondestroyView里面移除mRootView #50
Comments
hello,在BaseFragment 的 onCreateView里
有这段移除rootview的但是一直没有执行到,请问是否需要把这段父布局移除rootview的代码移到 ondestroyView里面 |
不用,销毁的时候mRootView也会销毁 |
我的场景是viewpager + fragment,有rootview的复用满足了需求,个人比较好奇rootview在什么时候销毁的 , 对应的Fragment ondestroy走了,rootview依然存在的 , viewpager用的FragmentStatePagerAdapter |
按我的理解,fragment的生命周期由FragmentStatePagerAdapter控制,在FragmentStatePagerAdapter里保存了你添加的每个fragment,虽然调用了ondestroy,但是fragment对象并没有被销毁,所以rootview依然存在 |
这种写法,在fragment 嵌套中 Leakcanary 会一直报内存泄漏。 |
No description provided.
The text was updated successfully, but these errors were encountered: