Yaniv
Yaniv

Reputation: 3381

Get rid of the strip line under the TabWidget

I'm using Android 3.0.

I've created TabHost with TabWidget in my layout and I add the tabs during runtime. I want to get rid of the blue line under the TabWidget which also indicates on the active tab. I've tried to set the strip to disabled but it didn't help. How can I do it?

Thanks

Upvotes: 1

Views: 1942

Answers (5)

If all of above way don't work, please try:

 tabHost.getTabWidget().getChildAt(0).setBackground(null);
 tabHost.getTabWidget().getChildAt(1).setBackground(null);
 ...

It work for me.

Upvotes: 1

You can use:

  tabHost.getTabWidget().getChildAt(0).setBackground(null);
  tabHost.getTabWidget().getChildAt(1).setBackground(null);
  ...

I fixed it by this way.

Upvotes: 0

Yaniv
Yaniv

Reputation: 3381

Well, I found a solution for this issue.
When creating the TabSpec, I've set an indicator which is an inflated layout resource. After using this, the strip is not shown anymore on the tabs' header.

// Inflates the icon layout for the tab
LinearLayout tabIconLayout = inflater.inflate(R.layout.tab_indicator, null);

TabSpec tabSpec = tabsHost.newTabSpec("...")
        .setIndicator(tabIconLayout)
        .setContent(mContentFactory);

mSocialNetworkTabsHost.addTab(tabSpec);

Thanks anyway for your help

Upvotes: 0

Nikola Despotoski
Nikola Despotoski

Reputation: 50538

Or do android:tabStripEnabled="false" in your XML

Upvotes: 0

berlindev
berlindev

Reputation: 1751

this should normally do it. how did you disable the strip?

tabHost.getTabWidget().setStripEnabled(false);

Upvotes: 0

Related Questions