问题描述
我读过周围的嵌套片段应避免(如:这里 ),但我不能看到如何做到以下几点:
I've read around that nesting Fragments should be avoided (eg. here), but I can't see how to do the following:
我工作的一个选项卡的应用程序(安卓的minSdkVersion =12
)具有以下界面:
I'm working on a tab application (android:minSdkVersion="12"
) with the following UI:
搜索栏始终在这里,用户可以通过以下菜单选项(家,画廊......)导航。我的想法是使用BaseActivity包含搜索栏和的FrameLayout中,我将加载对应用户的导航选择片段的布局。
The search bar is always here and the user can navigate through several menu options ('home', 'gallery'...). My idea was to use a BaseActivity with a layout containing the search bar and a FrameLayout in which I would load the Fragment corresponding to the user navigation choice.
我的问题是,在家片段我有几个标签,这是我想要实现同样的方式,即包含标签栏和的FrameLayout布局中,我将加载相应的片段,这导致嵌套片段...
My issue is that in the 'Home' Fragment I have several tabs, which I wanted to implement the same way, i.e. with a layout containing the tab bar and a FrameLayout in which I would load the corresponding Fragment, and this leads to nested Fragment...
我知道,而不是BaseActivity,我可以用几个活动,包括在每一个布局的搜索栏,但它会使其出现或消失每次用户会改变的活动......
I know that instead of the BaseActivity I could use several activities and include the search bar in every layout, but it would make it appear and disappear every time the user would change activities...
修改
我还需要一个固定的页脚,所以在他的回答提出的CommonsWare我无法用行动吧。
I also need a fixed footer, so I cannot use action bar as proposed by CommonsWare in his answer.
任何人都可以帮助?
推荐答案
有嵌套片段!!!!!!!在新的支持库版本(支持库V4,11版)
There is Nested Fragments!!!!!!! in the new support library version(support library v4 , version 11)
这篇关于是否有任何替代嵌套的片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!