2 回答

TA贡献1854条经验 获得超8个赞
如果我正确理解这一点,而不知道您拥有什么,而不查看“ fragment_container”的布局,那么我会告诉我,如果您不向其提供更多信息,则其类型ViewGroup此时只能有一个子级。
这意味着fragment_container已经有一个孩子,您需要在添加SimpleFragment.
假设您有第一个片段布局,如下所示
<someView>
<fragment_container/> // hear you are loading your first fragment and trying load the SimpleFragment as well which is causing problem.
</someView>
你需要的是
<someView>
<fragment_container/> only load First Fragment "first_fragment_layout.xml"
</someView>
在第一个片段的布局中
第一个_fragment_layout.xml
<someView>
<viewBlasBla/>
<viewBlasBla/>
<fragment_container/> load SimpleFragment here
</someView>
正如您所看到的,您确实正在尝试执行嵌套片段,这不是一个好的实践。如果可能的话尽量避免这种情况:)。
添加回答
举报