加载标签不同的活动 [英] load different activities in tabs
问题描述
花了相当长一段时间计算器搜索和谷歌并不能找到一个指导,正确地向我解释如何落实在我的应用程序标签。
It took quite a while searching stackoverflow and google and can not find a guide to properly explain to me how to implement Tabs in my application.
我知道它不应该被用来TabActivity,我也读到建议不要使用TabHost(至少是理解)。更换标签时,我的兴趣不只是改变了内容运行一个完整的活动。
I know it should not be used TabActivity, I also read about the recommendation not to use TabHost (at least that understanding). My interest is not just changing the content is run a full activity when changing tab.
MainActivity:
- Tab1Activity
- Tab2Activity
- Tab3Activity
我的目标是建立一个由各种设备通过api 8到最新的支持的应用程序。我使用 Android的支持 - v4.jar
。
我的第二个目标是因为至少有两个人消耗足够的资源和速度在每个标签加载一个活动应该总是prevail。
My second goal is to load in each tab an activity because at least two of them consume enough resources and speed should always prevail.
可以帮我指导或解释一个正确的方式来实现这一目标。
Can help me with a guide or explain a "correct" way to achieve this.
推荐答案
您应该使用标签与片段。
You should use Tabs with Fragments.
看看这个:<一href=\"http://android.$c$candmagic.org/2011/07/android-tabs-with-fragments/\">http://android.$c$candmagic.org/2011/07/android-tabs-with-fragments/
这篇关于加载标签不同的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!