TabHost.TabSpec setIndicator

时间:2013-07-26 13:29:16

标签: android android-tabhost tabactivity android-tabactivity

我想摆脱默认指标,以便在选择标签时获得相同的结果(无指标)。我试过了:

TabHost.TabSpec specs = tabHost.newTabSpec("").setIndicator("").setContent(intent);
TabHost.TabSpec specs = tabHost.newTabSpec("").setIndicator("",null).setContent(intent);

但这一切都没有奏效。如何删除该指示灯?
谢谢你的时间。

4 个答案:

答案 0 :(得分:1)

        TabHost  tabHost = getTabHost();

        TabSpec spec;

        Intent intent;

        //Home Tab
        View view1 = LayoutInflater.from(MainActivity.this).inflate(R.layout.home, null);

        intent = new Intent(MainActivity.this, Firstclass.class);

        spec = tabHost.newTabSpec("HOME").setIndicator(view1)
                .setContent(intent);

        tabHost.addTab(spec);

通过这种方式你可以摆脱它......

答案 1 :(得分:0)

删除他,试试这个:

TabHost.TabSpec specs = tabHost.newTabSpec("").setContent(intent);
TabHost.TabSpec specs = tabHost.newTabSpec("").setContent(intent);

答案 2 :(得分:0)

 private void addTab(String labelId, int drawableId, Class<?> c) {
    Intent intent = new Intent(this, c);
    tabHost = getTabHost();     
    TabHost.TabSpec spec = tabHost.newTabSpec(labelId);
    icon.setImageResource(drawableId);
    spec.setContent(intent);
    tabHost.addTab(spec);
}

答案 3 :(得分:0)

private static void addTab(TabMainActivity activity, TabHost tabHost,TabHost.TabSpec tabSpec, TabInfo tabInfo) 
{
    Drawable indicator = mContext .getResources().getDrawable( R.drawable.red_box );
    tabSpec.setIndicator(tag,indicator);
    tabHost.addTab(tabSpec);
}
相关问题