【发布时间】:2012-01-02 13:47:59
【问题描述】:
我在 Activty 中创建了一个 tabHost,每次到达 .addTab(Spec) 时它都会崩溃。 我在 Activity 中创建了选项卡主机,如下所示:
peopleTabHost = new TabHost(this);
然后我使用一种方法来添加选项卡(我可以这样做,因为我在 onCreat 之外将 peopleTabHost 定义为 final)
private void CreateNewTab(String tagName, String displayedName, Class<?> intentClass)
{
Intent intent = new Intent().setClass(this, intentClass);
TabHost.TabSpec spec = peopleTabHost.newTabSpec(tagName).setIndicator(displayedName);
spec.setContent(intent);
peopleTabHost.addTab(spec);
}
谢谢
【问题讨论】:
标签: java android tabs android-tabhost