【发布时间】:2023-11-15 16:22:01
【问题描述】:
在我的应用程序中,操作栏中有三个选项卡。
Tab A : contains 2 fragments
Tab B : contains a WebViewFragment
Tab C : contains a WebViewFragment
现在,我使用包含 LinearLayout 的全局布局。 我根据选项卡在 LinearLayout 中膨胀正确的布局。但是当我在 B -> A 之间切换时,我得到了这个错误:
Caused by: java.lang.IllegalArgumentException: Binary XML file line #8: Duplicate id 0x7f0a0002, tag null, or parent id 0xffffffff with another fragment for com.myapp.CategoriesFragment
处理这个问题的最佳解决方案是什么?
我试图删除所有视图/重新添加布局,但我得到了这个异常:
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
我认为我没有选择正确的解决方案。 谢谢你的回答
【问题讨论】:
标签: java android android-3.0-honeycomb android-fragments fragment