-1

我设置了没有 TabActivity 的选项卡,所以我的 tabHost 总是有错误。请告诉我该怎么做。谢谢。

private void setupTab(Class<?> ccls, String name, String label,
        Integer iconId) {
    Intent intent = new Intent().setClass(this, ccls);

    View tab = LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    ImageView image = (ImageView) tab.findViewById(R.id.icon);
    TextView text = (TextView) tab.findViewById(R.id.text);
    if (iconId != null) {
        image.setImageResource(iconId);
    }
    text.setText(label);

    TabSpec spec = tabHost.newTabSpec(name).setIndicator(tab)
            .setContent(intent);
    tabHost.addTab(spec);

}

我读了Android Tab-Host 来赚钱

4

1 回答 1

0

它无法建造。我由 tabHost 运行错误无法解决。

于 2013-07-12T01:18:27.593 回答