开发者

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 开发者_JS百科didn't help. How can I do it?

Thanks


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.


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

tabHost.getTabWidget().setStripEnabled(false);


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


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


You can use:

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

I fixed it by this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜