【问题标题】:Add FragmentActivity in TabHost在 TabHost 中添加 FragmentActivity
【发布时间】:2012-06-11 07:17:54
【问题描述】:

实际上,我有一个带有 Tabhost 的 FragmentActivity,里面有一些 Fragment,借助 ViewPager,您可以在不同的 Fragment 之间滑动。 有了这个 FragmentActivity,我想把它合并到另一个 Tabhost 中,所以有一个在另一个之下。

目前,我有这个解决方案:

public class TabsViewPagerFragmentActivity extends ActivityGroup {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Inflate the layout
    setContentView(R.layout.main);

    TabHost mTabHost = (TabHost)findViewById(R.id.testtabhost1);
    mTabHost.setup(getLocalActivityManager());

    TabSpec ts = mTabHost.newTabSpec("tab_test1").setIndicator("TAB1");
    ts.setContent(new Intent(this,PageGaucheFragment.class)); <--- PageGaucheFragment is the FragmentAtivity with the ViewPager that I would like to add into the TabHost

    mTabHost.addTab(ts);

    mTabHost.setCurrentTab(0);

}

它有效,但 ActivityGroup 已被弃用:(而且我没有找到任何其他解决方案来解决这个问题。我怎样才能拥有 2 个 TabHost 并且第二个可以在不同的 Fragment 之间滑动? 谢谢你的回答,对不起我的英语;)

【问题讨论】:

    标签: android android-tabhost android-viewpager android-fragmentactivity


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-18
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多