2

My question is more or less similar to this question, but the response approved as the answer for the same doesn't solve my issue.

I'm implementing tab structures using the FragmentTabHost class. When the tab background color is not explicitly specified, the tab indicator line seems to appear as Android provides. But when I programatically change the tab's background color, the tab indicators disappear (hidden).

Currently, I assign the tab background color this way :

 private void customizeTabbs() {

    for (int i = 0; i < mTabHost.getTabWidget().getTabCount(); i++) {
        View tabChild= mTabHost.getTabWidget().getChildAt(i);
        ..
        ..
        tabChild.setBackgroundResource(someColorResource);

    }

}

I also tried to change the background color in the XML way by adding to styles.xml , following this as:

 <item name="tabBackground">@color/someColor</item>
 <item name="tabIndicatorColor">?@color/someOtherColor</item>

The solution suggested for one similar question also did not help me.

Community
  • 1
  • 1
vardhinisuresh27
  • 371
  • 2
  • 6
  • 18
  • Are you changing all the tab colors or only the current selected tab? – Srijith Oct 14 '16 at 10:31
  • @Srijith I'm programatically setting the background color for the tabs and I don't want it to change during select/deselect and that's the code I've mentioned. – vardhinisuresh27 Oct 17 '16 at 01:50

0 Answers0