0

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.

GuilhE
  • 11,591
  • 16
  • 75
  • 116

4 Answers4

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

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

Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
  • Hey ,Nepster ,would you please explain what you did here?I have a question similar to this one and the only answer I got refers to a way of doing this thing in XML ,but I sort of "like" doing it programmatically and this seems to be the way ,is just that I don't really get all you are doing ,specially because I don't have acces to "getTabHost()" method. – Vlad Dec 26 '14 at 10:52
  • it is now deprecated why don't you use latest http://maxalley.wordpress.com/2013/05/18/android-creating-a-tab-layout-with-fragmenttabhost-and-fragments/ but if you still want to understand this , I have created Seperate classes for each view1 inflate my home screen in view1 and then i do it for all other tab and add them as i did in home Tab. – Zar E Ahmer Dec 26 '14 at 11:11
  • Thanks a ton for the link ,I have been looking for something that isn't deprecated and I couldn't find much...Gonna get into the documentation now.Cheers man! – Vlad Dec 26 '14 at 11:14
0

Just delete his, try this:

TabHost.TabSpec specs = tabHost.newTabSpec("").setContent(intent);
TabHost.TabSpec specs = tabHost.newTabSpec("").setContent(intent);
plsgogame
  • 1,334
  • 15
  • 28
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);
}
selva_pollachi
  • 4,147
  • 4
  • 29
  • 42
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);
}
Sergio
  • 6,900
  • 5
  • 31
  • 55