GuilhE
GuilhE

Reputation: 11891

TabHost.TabSpec setIndicator

I want to get rid of the default indicator to achieve the same result when a tab is selected (no indicator). I've tried:

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

But none of this worked. How can I remove that indicator?
Thanks for your time.

Upvotes: 0

Views: 5414

Answers (4)

Zar E Ahmer
Zar E Ahmer

Reputation: 34370

        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);

In this way you can get rid of it...

Upvotes: 1

nikhil pawar
nikhil pawar

Reputation: 1

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);
}

Upvotes: 0

selva_pollachi
selva_pollachi

Reputation: 4217

 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);
}

Upvotes: 0

plsgogame
plsgogame

Reputation: 1344

Just delete his, try this:

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

Upvotes: 0

Related Questions