【问题标题】:Using SectionsPagerAdapter android使用 SectionsPagerAdapter android
【发布时间】:2013-10-01 01:26:37
【问题描述】:

我有一个 sectionPagerAdapter 用作 ViewPager 的适配器。

    mSectionsPagerAdapter = new SectionsPagerAdapter(
            getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

我有 3 个片段,我想在单击按钮时在 2 个片段之间切换?

【问题讨论】:

    标签: android android-fragments


    【解决方案1】:

    我猜您的 SectionsPagerAdapter 是在您使用 ADT 创建新活动并指定带有选项卡的导航类型时自动生成的。如果是这种情况,那么您的 SectionsPagerAdapter 正在扩展 FragmentPagerAdapter,whose documentation is located here

    如果您真的想使用 ViewPager 来解决您所说的问题,请查看指向 Android 开发人员参考的链接。不过,听起来你想做一些更类似于what's discussed in this Q/A 的事情。也许您可以详细说明您想要完成的任务?

    【讨论】:

    • 我已经浏览了这些链接,我已经完成了我的研究并得到了输出。谢谢..:)
    猜你喜欢
    • 2017-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多