How can I change the colors of the tabs in the Action Bar depending on whether a tab is selected or not?
It should look like this: black when selected, and that kind of brown when not selected/inactive.
I tried to set it in the styles.xml but I couldn't find the proper name to make it work.
Thanks a lot for your help!
EDIT: I'm using the following piece of code for the TabsListener
class MyTabsListener implements TabListener {
private Fragment fragment;
public MyTabsListener(Fragment ef) {
this.fragment = ef;
}
public void onTabSelected(Tab tab, FragmentTransaction ft) {
ft.replace(R.id.realtabcontent, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
}
In fact it is pretty easy.All you should do is defining an attribute like this
<style name="tabtextcolor" parent="@style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">@android:color/white</item>
</style>
and then
adding these styles to your theme
<item name="actionBarTabTextStyle">@style/tabtextcolor</item>
<item name="android:actionBarTabTextStyle">@style/tabtextcolor</item>