2
大家好,我是012新手機。今天,我想在我的應用程序中使用「標籤」。因此,我參考了Android示例項目。
演示中有一些錯誤。首先,我創建一個Support4Demos並配置「構建路徑」。我使用Android工具 - >添加支持庫。然後,演示成功運行。
但是,這種方法似乎對我自己的項目沒用。
這是我的代碼,「FragmentStackSupport無法解析到某個類型」
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.
謝謝!
非常感謝!我已經解決了這個問題。 –