Android - 选项卡式片段
Android - Tabbed Fragment
我正在开发一个带有 activity 的应用程序,它可以在几个片段之间切换。我想知道是否有可能在操作栏中有一个带有选项卡的片段,而不是其他片段,因为知道通常 activity 是选项卡式的,并且选项卡在片段之间切换。
简而言之,我想要一个包含几个片段的 activity,其中一个片段应该有选项卡以在其他片段之间浏览,这可能吗?
当然可以,看看 Whosebug,已经有几个问题了。
而不是正常的 TabHost your should use FragmentTabHost and because you will have fragments inside a fragment, you will have to use getChildFragmentManager()而不是 getFragmentManager().
Adding tab inside fragment
不错 post 马可!我只是输入了基本相同的答案。这是关于 Nested Fragments 的文档的 link 希望对您有所帮助
我正在开发一个带有 activity 的应用程序,它可以在几个片段之间切换。我想知道是否有可能在操作栏中有一个带有选项卡的片段,而不是其他片段,因为知道通常 activity 是选项卡式的,并且选项卡在片段之间切换。 简而言之,我想要一个包含几个片段的 activity,其中一个片段应该有选项卡以在其他片段之间浏览,这可能吗?
当然可以,看看 Whosebug,已经有几个问题了。
而不是正常的 TabHost your should use FragmentTabHost and because you will have fragments inside a fragment, you will have to use getChildFragmentManager()而不是 getFragmentManager().
Adding tab inside fragment
不错 post 马可!我只是输入了基本相同的答案。这是关于 Nested Fragments 的文档的 link 希望对您有所帮助