【问题标题】:Prob to implement Tab using Fragments [duplicate]使用 Fragments 实现 Tab 的概率 [重复]
【发布时间】:2012-10-29 10:01:56
【问题描述】:

可能重复:
Android SDK Fragment Support

我尝试使用 FragmentActivity 来使用选项卡式视图。在为 Android 2.3 开发时,我使用了 android-support-v4.jar 来获取 Fragment 相关的类。我遵循了 Android 开发人员指南中TabActivity 中描述的代码。但是我在 TabManager 中使用标签的代码遇到了问题。

mTabManager.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
                FragmentStackSupport.CountingFragment.class, null);
        mTabManager.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
                LoaderCursorSupport.CursorLoaderListFragment.class, null);
        mTabManager.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"),
                LoaderCustomSupport.AppListFragment.class, null);
        mTabManager.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
                LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);

FragmentStackSupportLoaderCursorSupportLoaderCustomSupportLoaderThrottleSupport 类均不可导入。问题出在哪里?我只想设置带有文本或图像标题的简单选项卡。如何实现?

【问题讨论】:

标签: android tabs android-fragments fragment


【解决方案1】:

谢谢你,Kgiannakakis。这是解决方案:

Android SDK Fragment Support.

以下类不是标准 Android API(或支持库)的一部分,但仅存在于支持演示示例代码中,用于演示目的。任何人都可以在 X:\Program Files\Android\android-sdk\extras\android\support\samples\Support4Demos\src\com\example\android\supportv4\app 中获取文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-22
    • 2017-10-01
    • 1970-01-01
    • 2016-04-28
    • 2012-05-14
    • 1970-01-01
    相关资源
    最近更新 更多