I need to change the color of the indicator of the tab but I didn't manage to do this.
Do anyone know how to do?
This is my stiles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarTabTextStyle">#style/MyCustomTabView</item>
<item name="android:ratingBarStyleIndicator">#style/indicator_color</item>
<item name="android:actionBarTabStyle">#style/CustomActionBarTheme</item>
</style>
<style name="MyCustomTabView" parent="Theme.AppCompat.Light">
<item name="android:actionBarItemBackground">#style/indicator_color</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">12dp</item>
<item name="android:textStyle">bold</item>
<item name="android:backgroundStacked">#ffffff</item>
</style>
<style name="indicator_color">
<item name="android:background">#ffffff</item>
</style>
<style name="CustomActionBarTheme"
parent="Theme.">
<item name="android:actionBarTabStyle">#style/MyActionBarTabs</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs"
parent="Theme.AppCompat.Light">
<!-- tab indicator -->
<item name="android:background">#drawable/actionbar_tab_indicator</item>
</style>
and this is actionbar_tab_indicator.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- STATES WHEN BUTTON IS NOT PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<item android:state_focused="false" android:state_selected="true"
android:state_pressed="false"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<!-- Focused states (such as when focused with a d-pad or mouse hover) -->
<item android:state_focused="true" android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<item android:state_focused="true" android:state_selected="true"
android:state_pressed="false"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<!-- STATES WHEN BUTTON IS PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="true"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<item android:state_focused="false" android:state_selected="true"
android:state_pressed="true"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<!-- Focused states (such as when focused with a d-pad or mouse hover) -->
<item android:state_focused="true" android:state_selected="false"
android:state_pressed="true"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
<item android:state_focused="true" android:state_selected="true"
android:state_pressed="true"
android:drawable="#drawable/abc_ab_bottom_solid_light_holo" />
</selector>
Thanks in advance.
To change the indicator used for the navigation tabs, create an activity theme that overrides the actionBarTabStyle property. This property points to another style resource in which you override the background property that should specify a state-list drawable.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#style/Theme.Holo">
<item name="android:actionBarTabStyle">#style/MyActionBarTabs</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs"
parent="#style/Widget.Holo.ActionBar.TabView">
<!-- tab indicator -->
<item name="android:background">#drawable/actionbar_tab_indicator</item>
</style>
</resources>
Read more here.
You can change background of TabWidget(this is possibly what you are saying) like this:
If this is your style:
<style name="indicator_color">
<item name="android:background">#android:color/black</item>
</style>
Use it like this:
<TabWidget
style="#style/indicator_color"
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</TabWidget>
Also note that #ffffff is white color. So you may not see the effect.
Related
I already setup my tabhost background colour but it's not working.
styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
</style>
<style name="ActionBarTabStyle"
parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_bg_selector</item>
<item name="background">#drawable/tab_bg_selector</item>
</style>
tab_bg_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#color/blueLight" android:state_pressed="true"/>
<item android:drawable="#color/blueLight" android:state_selected="true"/>
<item android:drawable="#color/blueDark"/>
</selector>
bottom_tabs.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" />
<android.support.v4.app.FragmentTabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
Since you are using AppCompat library, use this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
</style>
<style name="ActionBarTabStyle"
parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_bg_selector</item>
<item name="background">#drawable/tab_bg_selector</item>
</style>
You needed the Widget.AppCompat.ActionBar.TabView parent and the android: variants for AppCompat support.
That is according to ActionBar's documentation and ActionBar Tab's documentation.
If you are OK to change color in code than you can try this:
tabHost.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String arg0) {
for (int i = 0; i < tab.getTabWidget().getChildCount(); i++) {
tab.getTabWidget().getChildAt(i)
.setBackgroundResource(R.drawable.tab_selected); // unselected
}
tab.getTabWidget().getChildAt(tab.getCurrentTab())
.setBackgroundResource(R.drawable.tab_unselected); // selected
}
});
You can try it:
tab_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:drawable="#drawable/unselected_tab" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
<item android:drawable="#drawable/button_buynow" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
<!-- Focused states -->
<item android:drawable="#drawable/unselected_tab" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
<item android:drawable="#drawable/selected_tab" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
<!-- Pressed -->
<!-- Non focused states -->
<item android:drawable="#drawable/unselected_tab" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/>
<item android:drawable="#drawable/button_buynow" android:state_focused="false" android:state_pressed="true" android:state_selected="true"/>
<!-- Focused states -->
<item android:drawable="#drawable/unselected_tab" android:state_focused="true" android:state_pressed="true" android:state_selected="false"/>
<item android:drawable="#drawable/button_buynow" android:state_focused="true" android:state_pressed="true" android:state_selected="true"/>
</selector>
After declaration in you MainActivity, you can use following code:
TabWidget widget = th.getTabWidget();
for (int i = 0; i < widget.getChildCount(); i++) {
View v = widget.getChildAt(i);
v.setBackgroundResource(R.drawable.tab_selector);
}
In your theme, add the following
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
Then add MyActionBar style (replace drawable entries with your own):
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- action bar background -->
<item name="background">#drawable/ab_solid_mytabhost</item>
<!-- needed for 'stacked' & 'split' action bar (used by tabhost) -->
<item name="backgroundStacked">#drawable/ab_stacked_solid_mytabhost</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_mytabhost</item>
</style>
Your styles.xml should look something like this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
</style>
<style name="ActionBarTabStyle" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_bg_selector</item>
<item name="background">#drawable/tab_bg_selector</item>
<!-- add these -->
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- add this-->
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- action bar background -->
<item name="background">#drawable/ab_solid_mytabhost</item>
<!-- needed for 'stacked' & 'split' action bar (used by tabhost) -->
<item name="backgroundStacked">#drawable/ab_stacked_solid_mytabhost</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_mytabhost</item>
</style>
For a working sample, here's a link to a sample project: https://github.com/ebernie/MyTabHostThemeSample
I am making a small program in which i am using Fragment Tabs with swipe, to make it stylish i used Style Generator, and my experience was good with that.
Now i wanna do a small change in existing look of my Tabs, this time i am talking about Tab Text style.
first view screen shot of my simple stylish ActionBar
Like we can see all Tab's text are looking equivalent, so here i need your help, in my case text style for selected Tab will remain same white as bold as it is looking, but want to change text style for others as normal (i mean those are not selected like:- IOS and WINDOWS)
styles.xml:
<resources>
<style name="Theme.Compatstyle4" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">#drawable/selectable_background_compatstyle4</item>
<item name="popupMenuStyle">#style/PopupMenu.Compatstyle4</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Compatstyle4</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Compatstyle4</item>
<item name="actionDropDownStyle">#style/DropDownNav.Compatstyle4</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Compatstyle4</item>
<item name="actionModeBackground">#drawable/cab_background_top_compatstyle4</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_compatstyle4</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Compatstyle4</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">#style/Theme.Compatstyle4.Widget</item>
</style>
<style name="ActionBar.Solid.Compatstyle4" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_compatstyle4</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_compatstyle4</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_compatstyle4</item>
<item name="progressBarStyle">#style/ProgressBar.Compatstyle4</item>
</style>
<style name="ActionBar.Transparent.Compatstyle4" parent="#style/Widget.AppCompat.ActionBar">
<item name="background">#drawable/ab_transparent_compatstyle4</item>
<item name="progressBarStyle">#style/ProgressBar.Compatstyle4</item>
</style>
<style name="PopupMenu.Compatstyle4" parent="#style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_compatstyle4</item>
</style>
<style name="DropDownListView.Compatstyle4" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_compatstyle4</item>
</style>
<style name="ActionBarTabStyle.Compatstyle4" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_compatstyle4</item>
</style>
<style name="DropDownNav.Compatstyle4" parent="#style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_compatstyle4</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_compatstyle4</item>
<item name="android:dropDownSelector">#drawable/selectable_background_compatstyle4</item>
</style>
<style name="ProgressBar.Compatstyle4" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_compatstyle4</item>
</style>
<style name="ActionButton.CloseMode.Compatstyle4" parent="#style/Widget.AppCompat.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_compatstyle4</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Compatstyle4.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Compatstyle4</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Compatstyle4</item>
</style>
</resources>
Like: I want to show text color as default for selected tab and gray for others
You will need to do settings in three places.
Your ActionBAr theme, where I set my tabstyle as a custom one defined below.
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="actionBarTabStyle">#style/CustomActionBarTabs</item>
<item name="actionBarTabTextStyle">#style/CustomActionBarTabs_TextColor</item>
My custom tab style which refers to a drawable selector for various states.
<!-- action bar tab styles -->
<style name="CustomActionBarTabs" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_custom_actionbar_style</item>
<item name="android:textColor">#666666</item>
</style>
My selector, set this as per your requirement.
<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_custom_actionbar_style" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="#drawable/tab_unselected_focused_custom_actionbar_style" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/tab_selected_focused_custom_actionbar_style" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed_custom_actionbar_style" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed_custom_actionbar_style" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed_custom_actionbar_style" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed_custom_actionbar_style" />
</selector>
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="#drawable/tab_unselected_focused_holo" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/tab_selected_focused_holo" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed_holo" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed_holo" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed_holo" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed_holo" />
I am using xml to change background of selected tab using Actionbar Tab with view pager
code is below,
style.xml
<!-- Custom theme. -->
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:windowActionBar">true</item>
<item name="android:actionBarSize">30dp</item>
<item name="android:icon">#drawable/logo</item>
<item name="android:actionBarTabTextStyle">#style/Widget.Holo.TabWidget</item>
<!-- <item name="android:actionBarTabTextStyle">#style/customTabBar</item> -->
</style>
<style name="Widget.Holo.TabWidget" parent="android:style/Widget.TabWidget">
<item name="android:tabStripLeft">#null</item>
<item name="android:tabStripRight">#null</item>
<item name="android:tabStripEnabled">true</item>
<!-- <item name="android:divider">#android:attr/dividerVertical</item> -->
<item name="android:showDividers">middle</item>
<item name="android:dividerPadding">8dip</item>
<item name="android:divider">#android:attr/dividerVertical</item>
<item name="android:dividerHeight">10dp</item>
<item name="android:measureWithLargestChild">true</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">bold</item>
<item name="android:background">#drawable/tab_bg_selector</item>
</style>
tab_bg_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Active tab -->
<item android:drawable="#drawable/tab_bg_selected" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
<!-- Inactive tab
<item android:drawable="#drawable/tab_bg_unselected" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
-->
<item android:drawable="#android:color/transparent" android:state_pressed="true"/>
<!-- Selected tab (using d-pad) -->
<item android:drawable="#android:color/transparent" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
tab_bg_selected.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#7F7F7F"
android:endColor="#696969"
android:startColor="#A8A8A8" />
</shape>
It shows me changed color but color is changes for text background only I want to change for whole Tab selected
See below image,
These custom styles work fine for me
<style name="MyActionBarTabStyle" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:tabStripEnabled">false</item>
<item name="android:footerDividersEnabled">false</item>
<item name="android:background">#drawable/tab_selector</item>
<item name="background">#drawable/tab_selector</item>
</style>
And
<style name="MyActionBarTabTextStyle" parent="#style/Widget.AppCompat.Light.ActionBar.TabText">
<item name="android:textColor">#color/tab_text_color</item>
<item name="android:textSize">12sp</item>
<item name="android:gravity">fill_horizontal</item>
</style>
I hope it works fine for u as well
Take a look to this: Styling Tabs
I'm trying to customize my ActionBar's tab indicator following this reference, however I'm getting the error:
Error retrieving parent for item: No resource found that matches the given name '#style/Widget.Holo.ActionBar.TabView'.
Minimum SDK is set to 14, target SDK = 18. Any ideas?
EDIT:
I already have the following styles which work:
<style name="sMain" parent="#android:style/Theme.Holo">
<item name="android:icon">#android:color/transparent</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarDivider">#null</item>
</style>
<style name="MyActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:actionBarDivider">#null</item>
</style>
You should be referencing
#android:style/Widget.Holo.ActionBar.TabView
Typo in the docs - they left off the android:.
This is what you need to do:
Create a Style for your app:
Here I am customizing the Tab Bar and it's text (I am using a base compatibility theme but you can use HOLO or anything you like):
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarTabTextStyle">#style/TabTextStyle</item>
<item name="android:actionBarTabStyle">#style/TabBarStyle</item>
<!-- Support library compatibility (ActionBarCompat) -->
<item name="actionBarTabTextStyle">#style/TabTextStyle</item>
<item name="actionBarTabStyle">#style/TabBarStyle</item>
</style>
Create those styles:
<style name="TabTextStyle" parent="#style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">#color/ab_tab_txt</item>
</style>
<style name="TabBarStyle" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator</item>
</style>
For the color and drawables, you can create a selector that allows the tab to change based on clicks and selection:
File: res/color/ab_tab_txt (I am using the color file from res/values to set my constants, but you can place the color like so: #FFF)
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#color/ab_tab_txt_selected"/>
<item android:color="#color/ab_tab_txt_unselected"/>
</selector>
File res/drawable/tab_indicator
<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_example" />
<!-- Focused states -->
<item android:state_focused="true"
android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/tab_unselected_focused_example" />
<item android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="#drawable/tab_selected_focused_example" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false"
android:state_selected="false"
android:state_pressed="true"
android:drawable="#drawable/tab_unselected_pressed_example" />
<item android:state_focused="false"
android:state_selected="true"
android:state_pressed="true"
android:drawable="#drawable/tab_selected_pressed_example" />
<!-- Focused states -->
<item android:state_focused="true"
android:state_selected="false"
android:state_pressed="true"
android:drawable="#drawable/tab_unselected_pressed_example" />
<item android:state_focused="true"
android:state_selected="true"
android:state_pressed="true"
android:drawable="#drawable/tab_selected_pressed_example" />
</selector>
My drawable files are NinePatches that I create using this useful tool:
http://jgilfelt.github.io/android-actionbarstylegenerator/
Ok i'm loosing more sanity then ever. I can't find/understand how to style the damn thing.
I managed to change the background of the tab itself but I can't cahnge the color of the bar under the selected tab.
How to change it from blue to something.
My styles.xml unfortunately I have very bad understanding of how it works
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Styled" parent="Theme.Sherlock.Light">
<item name="actionBarTabStyle">#style/Widget.Styled.ActionBarTab</item>
<item name="android:actionBarTabStyle">#style/Widget.Styled.ActionBarTab</item>
<item name="actionBarTabBarStyle">#style/Widget.Styled.ActionBarTabBar</item>
<item name="android:actionBarTabBarStyle">#style/Widget.Styled.ActionBarTabBar</item>
<item name="actionBarTabTextStyle">#style/myText</item>
<item name="android:actionBarTabTextStyle">#style/myText</item>
</style>
<style name="Widget.Styled.ActionBarTab" parent="Widget.Sherlock.Light.ActionBar.TabView">
<!-- <item name="background">#drawable/startbcg</item>
<item name="android:background">#drawable/startbcg</item>
<item name="backgroundSplit">#drawable/bg_striped_split</item>
<item name="android:backgroundSplit">#drawable/bg_striped_split</item>
-->
</style>
<style name="Widget.Styled.ActionBarTabBar" parent="Widget.Sherlock.Light.ActionBar.TabBar">
<item name="background">#drawable/startbcg</item>
<item name="android:background">#drawable/startbcg</item>
<item name="backgroundSplit">#drawable/bg_striped_split</item>
<item name="android:backgroundSplit">#drawable/bg_striped_split</item>
</style>
<style name="myText" parent="Widget.Sherlock.Light.ActionBar.TabText">
<item name="android:textAppearance">#android:style/TextAppearance.Medium</item>
<item name="android:textColor">#android:color/primary_text_dark</item>
<item name="android:textSize">10sp</item>
</style>
<style name="myTextInv" parent="Widget.Sherlock.Light.ActionBar.TabText.Inverse">
<item name="android:textAppearance">#android:style/TextAppearance.Medium</item>
<item name="android:textColor">#android:color/primary_text_dark</item>
<item name="android:textSize">10sp</item>
</style>
</resources>
Bonus question: where I can find what properties (like background) certain stuff has.
Use ActionbarStyleGenerator to style the Actionbar. This is by far the simplest and most intuitive way.
How to:
Use the UI to select colors for different items
Once done click on "DOWNLOAD .ZIP"
The ZIP file contains resource files that you have to copy in your project res/layout and
res/drawableXXXX folders
I found that for the background it's better to copy the drawables (9 patches and xml) found on the Android SDK res directory and change it to have the color you like.
They use a background with the bottom bar included, so I don't think it's possible to change the bottom bar alone.
Here's what I have, working with green color for the bottom bar:
<style name="customTabStyle" parent="Widget.Sherlock.ActionBar.TabView">
<item name="android:showDividers">none</item>
<item name="android:measureWithLargestChild">true</item>
<!-- This was a copy from the sdk drawable -->
<item name="android:background">#drawable/tab_indicator</item>
<item name="background">#drawable/tab_indicator</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">normal</item>
</style>
<style name="customTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:showDividers">middle</item>
<item name="android:divider">#drawable/tab_divider</item>
<item name="divider">#drawable/tab_divider</item>
<item name="android:dividerPadding">10dip</item>
<item name="android:background">#drawable/tab_bg</item>
</style>
The tab indicator looks like this:
<?xml version="1.0" encoding="utf-8"?>
<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="#drawable/tab_unselected" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/tab_selected" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="#drawable/tab_unselected_focused" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/tab_selected_focused" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/tab_unselected_pressed" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/tab_selected_pressed" />
</selector>
I hope it helps!