-
Notifications
You must be signed in to change notification settings - Fork 77
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
androidx.fragment.app.FragmentContainerView #42
Comments
使用navigation组件,单activity嵌套多个fragment,parent为androidx.fragment.app.FragmentContainerView |
请了解 FragmentContainerView 的特性,你可以 inject activity 也可以 inject 具体的 fragment,也可以对具体的 view |
FragmentContainerView 继承 FrameLayout,FrameLayout无法使用addview方法 |
不要去 inject FragmentContainerView ,https://developer.android.google.cn/reference/kotlin/androidx/fragment/app/FragmentContainerView |
fragment 里面使用了stateview,布局文件是用了fragment标签,他的view.parent为FragmentContainerView |
|
该 fragment 的 onCreateView 返回的 view 是什么,你是直接 inject 的这个 view 吗 |
是的,我新增了上述的判断,解决了该问题 |
|
如果使用jetpack中的navigation组件,会有这样的场景 |
看样是需要加多个判断 FragmentContainerView,估计以后也会有新的这类特殊 ViewGroup |
@luojt 已发版,v3.0.2 |
@nukc 收到,很优秀 |
@nukc 我觉得这样判断会不会更好一点
FragmentContainerView是FrameLayout的子类,我测试了一下可以 |
FragmentContainerView 才是特殊的,FrameLayout 是很常用的,且是正常的 |
好的,明白了 |
当不引用 androidx.fragment:fragment 的时候回报 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/fragment/app/FragmentContainerView; |
如果parent为androidx.fragment.app.FragmentContainerView,会报错
The text was updated successfully, but these errors were encountered: