对于标签导航最佳实践?标签

2023-09-12 02:31:56 作者:离沦的海。

我要寻找使用标签导航与福尔摩斯动作条的最佳实践。 是什么改变了片段,并添加片段与backstack和清除后退堆栈时,选择其他选项卡的正确方法。

I am looking for best practice of using tab navigation with sherlock actionbar. What is the proper way of changing the fragments, and adding fragments to the backstack and clearing the back stack when another tab is selected.

有没有什么好的例子或开源项目展示了如何做是正确的?

Are there any good examples or open source projects showing how to do it right?

推荐答案

我不会用ABS直接做到这一点。你会遇到麻烦,一旦你的标签所需要的片段切换等等。我认为正确的方式来做到这一点是使用ViewPagerIndicator,这与ABS兼容。作为奖励,你还可以获得刷卡右 - 左选项卡之间。 您需要compat的包(像ABS),例如使用可以在找到 samples文件夹。

I wouldn't use ABS directly to do that. You will run into trouble once your tabs require fragment switching etc. I think the right approach to do this is to use ViewPagerIndicator, which is compatible with ABS. As bonus you also get the swipe right-left between tabs. You need the compat package (like for ABS), example usage you can find in the samples folder.