The FragmentTabHost
returns the TabWidget
(only one), which is the View
responsible for drawing these tabs. Each child is a different tab.
The color setting of Tab
of Style Generator
applies only to Tab
of ActionBar
.
In your case you’re using the TabHost
and the TabWidget
, and that style does not apply to them, unfortunately.
To customize the tab, you need to recover the TabWidget
and stylize each child. That way:
// Assim como voce mencionou
TabWidget tabWidget = mTabHost.getTabWidget();
// Como o TabWidget eh um ViewGroup, ele tem filhos e podemos iterar
// sobre os mesmos
int childCount = tabWidget.getChildCount();
for(int i = 0; i < childCount; ++i) {
View child = tabWidget.getChildTabViewAt(i);
// Que eh o mesmo que
//View child = tabWidget.getChildAt(i);
// Vide o codigo fonte
// O Drawable vai variar conforme o nome do seu tema, confirme se tem
// algum nome parecido com esse e altere aqui
child.setBackgroundResource(R.drawable.tab_indicator_ab);
}
Use this code at the end of the TabHost
.
The archive tab_indicator_ab.xml
that is in the directory /res/drawable
is very similar to this:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_ab" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_ab" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_ab" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_ab" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_ab" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_ab" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_ab" />
</selector>
If the settings you used are the same ones I saw when I opened (no loss), missed you specify the
Style compatibility
asAppCompat
. The current one is likeHolo
, which ignores some specific style settings ofAppCompat
.– Wakim
Actually I put as Appcompat, the link that should not have loaded this option :/ I checked the Xmls and all have this compatibility...
– Mukotoshi
Okay, he lost the information, sorry. By the way... How are you doing these tabs? Using the
ActionBar.NAVIGATION_MODE_TABS
? Or is using another library?– Wakim
I’m using Fragments: android.support.v4.app.Fragmenttabhost and tabs with Tabwidget. I managed to change the background of the tabs, but the indicator I could not change in any way :'(
– Mukotoshi
Try to do the following, I can not test but I think it will work (if I give it as an answer). Itere on the children of
TabWidget
(usinggetChildAt(...)
andgetChildCount
) and use thesetBackgroundResource
like thedrawable
tab_indicator_ab
generated byStyle Generator
). This after you have set up all theTabs
.– Wakim
Sorry, I am extremely novice on Android, how would I iterate on the Tabwidgets? 
 mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("A"), Teste1.class, null);
 mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("B"), Teste2.class, null);

A "mTabHost" é um FragmentTabHost, tem um método chamado getTabWidget, it returns all Tabwidgets or only the last?
– Mukotoshi
I will assemble an answer exemplifying how it should be done.
– Wakim
Thank you very much, thank you very much!
– Mukotoshi