android - "FragmentStackSupport cannot be resolved to a type"

标签 android tabs


大家好,
我是安卓新手。今天,我想在我的应用程序中使用“标签”。因此,我引用了 Android 示例项目。
演示中有一些错误。首先,我创建一个 Support4Demos 并配置“构建路径”。我使用 Android 工具-> 添加支持库。至此,demo 运行成功。
不过这个方法在我自己的项目上好像没用。
这是我的代码,

package com.example.wepay;

import com.example.wepay.R;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;

public class FragmentTabs extends FragmentActivity {
private FragmentTabHost mTabHost;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_account);
        mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
        mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);

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


这些是我的错误。

 FragmentStackSupport cannot be resolved to a type.
 LoaderCursorSupport cannot be resolved to a type.
 LoaderCustomSupport cannot be resolved to a type.
 LoaderThrottleSupport cannot be resolved to a type.

谢谢!

最佳答案

这些不是系统提供的类,不会出现在您的解决方案中。它只是样本的另一部分,如 here 所述.

关于android - "FragmentStackSupport cannot be resolved to a type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17607390/

相关文章:

c# - 我应该加密我的 Unity 代码来构建 IOS 游戏吗?

android - Play 商店国家/地区分布(发布)

android - 如何重叠系统底部导航栏。?

HTML CSS 选项卡控件 - 同一页面上的多个选项卡控件

ios - 启动时崩溃 - ios 8.1 因为添加了 UIButton 的 subview 。 EXC_BREAKPOINT(SIGTRAP)

javascript - 垂直制表符在 github 上显示不正确

java - android中的NullPointerException,可能是数据库问题

android - "android.intent.extra.STREAM"

javascript - jQuery UI 选项卡 - 如何在悬停时选择选项卡

html - css3 仅选项卡预选选项卡