I use the code below to change the style of a tabbed activity in my application:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="actionBarStyle">#style/ActionBarTheme</item>
</style>
<!-- Action Bar them -->
<style name="ActionBarTheme" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_appolo</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_appolo</item>
<item name="titleTextStyle">#style/ActionBarText</item>
<item name="icon">#drawable/ic_action_launcher</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Appolo</item>
</style>
<style name="ActionBarText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#000000</item>
</style>
<!-- ActionBar tabs styles -->
<style name="ActionBarTabStyle.Appolo" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="background">#drawable/actionbar_tab_indicator</item>
</style>
This is the actionbar_tab_indicator content:
<?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="#android:color/transparent" />
<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 also use the code below for styles in style-v11 and style-v14:
...
<style name="ActionBarTheme" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_appolo</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_appolo</item>
<item name="android:titleTextStyle">#style/ActionBarText</item>
<item name="android:icon">#drawable/ic_action_launcher</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Appolo</item>
</style>
<style name="ActionBarText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#000000</item>
</style>
<!-- ActionBar tabs styles -->
<style name="ActionBarTabStyle.Appolo" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/actionbar_tab_indicator</item>
</style>
...
But it is not changing the style of the tab bar.
I checked my code many times, I searched and reviewed all my notes but I can't find what the problem is. Does anyone have any answers?
The problem was in this part of code:
<style name="ActionBarTheme" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_appolo</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_appolo</item>
<item name="titleTextStyle">#style/ActionBarText</item>
<item name="icon">#drawable/ic_action_launcher</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Appolo</item>
and especially this line:
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Appolo</item>
this line should not be in the custom them that I want to use as my action bar theme. The right way is adding this under my custom app them so I remove this line from above part and add it under AppBaseTheme:
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="actionBarStyle">#style/ActionBarTheme</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Appolo</item>
</style>
and now the code is working right.
Write this in your style xml file.
<item name="actionBarTabStyle">#style/CustomActionBarTabs </item>
<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>
Try this:
<style name="ActionBarTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/ActionBarTheme.ActionBarStyle</item>
</style>
<style name="ActionBarTheme.ActionBarStlye" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_solid_appolo</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_appolo</item>
<item name="android:titleTextStyle">#style/ActionBarTheme.ActionBar.TitleTextStyle</item>
<item name="android:icon">#drawable/ic_action_launcher</item>
<item name="android:actionBarTabStyle">#style/ActionBarTheme.ActionBar.TabStyle</item>
</style>
<style name="ActionBarTheme.ActionBar.TitleTextStyle" parent="#style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#000000</item>
</style>
<!-- ActionBar tabs styles -->
<style name="ActionBarTheme.ActionBar.TabStyle" parent="#style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/actionbar_tab_indicator</item>
</style>
Also make sure you're using your theme in the AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/ActionBarTheme" >
I have noticed, with older versions of Android, the app crashes if the Theme is not a child of AppCompat. This should be a work around.
EDIT: you also forgot to put android: before background, icon, etc.
Make sure that You have applied app-theme in manifest file.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme"
android:uiOptions="splitActionBarWhenNarrow" >
Related
I made a custom Theme, but I got an error
Error retrieving parent for item: No resource found that matches the given name
in styles.xml file. Where is my mistake?
My themes.xml:
<!-- Custom Theme Design By Hossein -->
<style name="Theme.CustomThemeHossein">
<item name="android:windowNoTitle">true</item>
<item name="colorBackground">#android:color/background_light</item>
<item name="windowBackground">#android:drawable/bghos</item>
<item name="colorBackground">#android:color/background_light</item>
<item name="colorForeground">#color/bright_foreground_light</item>
<item name="colorForegroundInverse">#android:color/bright_foreground_light_inverse</item>
<item name="textColorPrimary">#android:color/primary_text_light</item>
<item name="textColorSecondary">#android:color/secondary_text_light</item>
<item name="textColorTertiary">#android:color/tertiary_text_light</item>
<item name="textColorPrimaryInverse">#android:color/primary_text_dark</item>
<item name="textColorSecondaryInverse">#android:color/secondary_text_dark</item>
<item name="textColorTertiaryInverse">#android:color/tertiary_text_dark</item>
<item name="textColorPrimaryDisableOnly">#android:color/primary_text_light_disable_only</item>
<item name="textColorPrimaryInverseDisableOnly">#android:color/primary_text_dark_disable_only</item>
<item name="textColorPrimaryNoDisable">#android:color/primary_text_light_nodisable</item>
<item name="textColorSecondaryNoDisable">#android:color/secondary_text_light_nodisable</item>
<item name="textColorPrimaryInverseNoDisable">#android:color/primary_text_dark_nodisable</item>
<item name="textColorSecondaryInverseNoDisable">#android:color/secondary_text_dark_nodisable</item>
<item name="textColorHint">#android:color/hint_foreground_light</item>
<item name="textColorHintInverse">#android:color/hint_foreground_dark</item>
<item name="textColorHighlight">#android:color/highlighted_text_light</item>
<item name="textColorHighlightInverse">#android:color/highlighted_text_dark</item>
<item name="textColorLink">#android:color/link_text_light</item>
<item name="textColorLinkInverse">#android:color/link_text_dark</item>
<item name="editTextColor">#android:color/primary_text_light</item>
<item name="listChoiceBackgroundIndicator">#android:drawable/list_selector_background</item>
<item name="activatedBackgroundIndicator">#android:drawable/activated_background_light</item>
<item name="quickContactBadgeOverlay">#android:drawable/quickcontact_badge_overlay_light</item>
<item name="popupWindowStyle">#android:style/Widget.PopupWindow</item>
<item name="textCheckMark">#android:drawable/indicator_check_mark_light</item>
<item name="textCheckMarkInverse">#android:drawable/indicator_check_mark_dark</item>
<item name="gestureOverlayViewStyle">#android:style/Widget.GestureOverlayView.White</item>
<item name="expandableListViewStyle">#android:style/Widget.ExpandableListView.White</item>
<item name="listViewStyle">#android:style/Widget.ListView.White</item>
<item name="listDivider">#drawable/divider_horizontal_bright</item>
<item name="listSeparatorTextViewStyle">#android:style/Widget.TextView.ListSeparator.White</item>
<item name="progressBarStyle">#android:style/Widget.ProgressBar.Inverse</item>
<item name="progressBarStyleSmall">#android:style/Widget.ProgressBar.Small.Inverse</item>
<item name="progressBarStyleLarge">#android:style/Widget.ProgressBar.Large.Inverse</item>
<item name="progressBarStyleInverse">#android:style/Widget.ProgressBar</item>
<item name="progressBarStyleSmallInverse">#android:style/Widget.ProgressBar.Small</item>
<item name="progressBarStyleLargeInverse">#android:style/Widget.ProgressBar.Large</item>
<item name="actionModeCutDrawable">#android:drawable/ic_menu_cut_holo_light</item>
<item name="actionModeCopyDrawable">#android:drawable/ic_menu_copy_holo_light</item>
<item name="actionModePasteDrawable">#android:drawable/ic_menu_paste_holo_light</item>
<item name="actionModeSelectAllDrawable">#android:drawable/ic_menu_selectall_holo_light</item>
<item name="actionModeShareDrawable">#android:drawable/ic_menu_share_holo_light</item>
<item name="actionModeFindDrawable">#android:drawable/ic_menu_find_holo_light</item>
<item name="actionModeWebSearchDrawable">#android:drawable/ic_menu_search_holo_light</item>
<item name="actionModeBackground">#android:drawable/cab_background_top_holo_light</item>
<item name="actionModeSplitBackground">#android:drawable/cab_background_bottom_holo_light</item>
<!-- SearchView attributes -->
<item name="searchDropdownBackground">#android:drawable/search_dropdown_light</item>
<item name="searchViewTextField">#drawable/textfield_searchview_holo_light</item>
<item name="searchViewTextFieldRight">#drawable/textfield_searchview_right_holo_light</item>
<item name="searchViewCloseIcon">#android:drawable/ic_clear_holo_light</item>
<item name="searchViewSearchIcon">#android:drawable/ic_search_api_holo_light</item>
<item name="searchViewGoIcon">#android:drawable/ic_go_search_api_holo_light</item>
<item name="searchViewVoiceIcon">#android:drawable/ic_voice_search_api_holo_light</item>
<item name="searchViewEditQuery">#android:drawable/ic_commit_search_api_holo_light</item>
<item name="detailsElementBackground">#android:drawable/panel_bg_holo_light</item>
<item name="mediaRouteButtonStyle">#android:style/Widget.DeviceDefault.Light.MediaRouteButton</item>
<item name="findOnPageNextDrawable">#android:drawable/ic_find_next_holo_light</item>
<item name="findOnPagePreviousDrawable">#android:drawable/ic_find_previous_holo_light</item>
</style>
My styles.xml:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="CustomThemeHossein" parent="android:Theme.CustomThemeHossein">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
My AndroidManifest.xml:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomThemeHossein" >
The error:
[2015-12-18 14:19:54 - WifiTrafficMonitor] E:\E\All-Project\Android\WifiTrafficMonitor\res\values\styles.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.CustomThemeHossein'.
How to solve it?
You have to change Theme.CustomThemeHossein by:
<style name="CustomThemeHossein">
in themes.xml and call this theme with:
<style name="ThemeHossein" parent="#style/CustomThemeHossein">
Because it's a <style> and not a <theme>.
In the ApplicationManifest I have:
<application android:theme="#style/AppTheme" >
And as a style I have:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowBackground">#null</item>
<item name="metaButtonBarStyle">#style/ButtonBar</item>
<item name="metaButtonBarButtonStyle">#style/ButtonBarButton</item>
</style>
<!-- Backward-compatible version of ?android:attr/buttonBarStyle -->
<style name="ButtonBar">
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingTop">5dp</item>
<item name="android:paddingRight">2dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:background">#android:drawable/bottom_bar</item>
</style>
<!-- Backward-compatible version of ?android:attr/buttonBarButtonStyle -->
<style name="ButtonBarButton" />
</resources>
In preview mode, the Actionbar can be seen. However, on my device it is not. What am I missing?
Try to change parent theme of "AppTheme" to another one, i.e. "Theme.Holo.Light".
Actually actionbar is there but the menus are not visible
modify your res->menu-> main.xml
<item
android:id="#+id/action_settings"
android:orderInCategory="100"
android:title="#string/action_settings"/>
like this
remove line
android:showAsAction="never"
My god...
In my case there was two styles.xml - in feature and installed.. both should be the same
Am using ViewPager and TabPageIndicator for showing multiple tabs.
I have applied all the styles also added android:theme="#style/StyledIndicators
in manifest. But still not getting desier output.
What am expecting is
but my current output is
Am i missing any thing? I have added all required images in drawebales.
And here is my style.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="PoppupMenu" parent="android:Widget.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
</style>
<style name="Widget"></style>
<style name="TextAppearance.TabPageIndicator" parent="Widget">
<!-- <item name="android:textStyle">bold</item> -->
<!-- <item name="android:textColor">#color/vpi__dark_theme</item> -->
</style>
<style name="StyledIndicators" parent="AppBaseTheme">
<item name="vpiTabPageIndicatorStyle">#style/CustomTabPageIndicator</item>
</style>
<style name="Widget.TabPageIndicator" parent="Widget">
<item name="android:gravity">center</item>
<item name="android:background">#FFFFFF</item>
<item name="android:paddingLeft">10dip</item>
<item name="android:paddingRight">10dip</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:textAppearance">#style/TextAppearance.TabPageIndicator</item>
<item name="android:textSize">14sp</item>
<item name="android:maxLines">1</item>
<item name="android:divider">#drawable/custom_tab_indicator_divider</item>
<item name="android:showDividers">middle</item>
<item name="android:dividerPadding">5dp</item>
<item name="android:height">40dp</item>
</style>
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:background">#drawable/custom_tab_indicator</item>
<item name="android:textColor">#218801</item>
<item name="android:textSize">14sp</item>
<item name="android:divider">#drawable/custom_tab_indicator_divider</item>
<item name="android:showDividers">middle</item>
<item name="android:fadingEdge">horizontal</item>
<item name="android:fadingEdgeLength">8dp</item>
</style>
and custom_tab_indicator.xml is
<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/custom_tab_indicator_unselected" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/custom_tab_indicator_selected" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="#drawable/custom_tab_indicator_unselected_focused" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="#drawable/custom_tab_indicator_focused" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/custom_tab_indicator_unselected_pressed" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/custom_tab_indicator_selected_pressed" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="#drawable/custom_tab_indicator_unselected_pressed" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="#drawable/custom_tab_indicator_selected_pressed" />
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.
I want to to customize my app and i've applied a theme but the options menu doesn't seem to apply my theme.
I want my text color to be white, my background to be black and the highlighted/selected menu item to be yellow.
Here is my theme.xml:
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarTabTextStyle">#style/MyActionBarTabText</item>
<item name="android:actionMenuTextColor">#color/application_color5</item>
<item name="android:actionBarTabStyle">#style/MyActionBarTabs</item>
<item name="android:selectableItemBackground">#drawable/icone_barratopo_selector</item>
<item name="android:actionBarItemBackground">#drawable/icone_barratopo_selector</item>
<item name="android:selectableItemBackground">#drawable/icone_barratopo_selector</item>
<!-- Panel attributes -->
<!-- <item name="android:panelBackground">#drawable/selectable_background</item> --
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionBarTabTextStyle">#style/MyActionBarTabText</item>
<item name="actionMenuTextColor">#color/application_color5</item>
<item name="actionBarTabStyle">#style/MyActionBarTabs</item>
<item name="selectableItemBackground">#drawable/icone_barratopo_selector</item>
<item name="actionBarItemBackground">#drawable/icone_barratopo_selector</item>
<item name="selectableItemBackground">#drawable/icone_barratopo_selector</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/background_barratopo_superior</item>
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="background">#drawable/background_barratopo_superior</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/application_color2</item>
</style>
<!-- ActionBar tabs text -->
<style name="MyActionBarTabText" parent="#style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">#drawable/tab_text_selector</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs" parent="#style/Widget.AppCompat.ActionBar.TabView">
<!-- tab indicator -->
<item name="android:background">#drawable/actionbar_tab_indicator</item>
<!-- Support library compatibility -->
<item name="background">#drawable/actionbar_tab_indicator</item>
</style>
My menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motobox="http://schemas.android.com/apk/res-auto" >
<!--
<item
android:id="#+id/option_availability"
android:icon="#drawable/icone_barratopo_mymotobox"
android:orderInCategory="100"
motobox:showAsAction="always"/>
-->
<item
android:id="#+id/option_refresh"
android:icon="#drawable/icone_barratopo_back"
android:orderInCategory="100"
motobox:showAsAction="always"/>
<item
android:id="#+id/status"
android:orderInCategory="100"
android:title="Indisponível"
motobox:showAsAction="never"/>
<item
android:id="#+id/logout"
android:orderInCategory="100"
android:title="Logout"
motobox:showAsAction="never"/>
and my selector.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#color/application_color3" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
<!-- Pressed -->
<item android:drawable="#color/application_color2" android:state_pressed="true"/>
<!-- Focused -->
<item android:drawable="#color/application_color2" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
Rename your file from theme.xml to
res/values/themes.xml
And remember you can apply your theme to your entire app
<application android:theme="#style/myCustomTheme">
or individual activities
<activity android:theme="#android:style/myCustomTheme">
Edit the line:
<item name="background">#drawable/actionbar_tab_indicator</item>
to
<item name="android:background">#drawable/actionbar_tab_indicator</item>
:)