Change title color ActionBar

0

This is my new layout, however the overflow items have gone blank with white background, and I need white background with black letters. Remembering that I used the stylegenerator.

<style name="Theme.Datalayer" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@drawable/selectable_background_datalayer</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Datalayer</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Datalayer</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Datalayer</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Datalayer</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.Datalayer</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_datalayer</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_datalayer</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Datalayer</item>
   <item name="android:actionMenuTextColor">@color/black</item>
    <!-- Light.DarkActionBar specific -->
    <item name="android:actionBarWidgetTheme">@style/Theme.Datalayer.Widget</item>
</style>

<style name="ActionBar.Solid.Datalayer" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/ab_solid_datalayer</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_datalayer</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_datalayer</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Datalayer</item>
</style>

<style name="ActionBar.Transparent.Datalayer" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@drawable/ab_transparent_datalayer</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Datalayer</item>
</style>

<style name="PopupMenu.Datalayer" parent="@android:style/Widget.Holo.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_datalayer</item>
    <item name="android:textColor">@color/black</item>
</style>

<style name="DropDownListView.Datalayer" parent="@android:style/Widget.Holo.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_datalayer</item>
</style>

<style name="ActionBarTabStyle.Datalayer" parent="@android:style/Widget.Holo.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator_ab_datalayer</item>
</style>

<style name="DropDownNav.Datalayer" parent="@android:style/Widget.Holo.Spinner">
    <item name="android:background">@drawable/spinner_background_ab_datalayer</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_datalayer</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_datalayer</item>
    <item name="android:spinnerDropDownItemStyle">@style/mySpinnerItemStyle</item>
</style>

<style name="mySpinnerItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
    <item name="android:textColor">@color/black</item>
</style>

<style name="ProgressBar.Datalayer" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_datalayer</item>
</style>

<style name="ActionButton.CloseMode.Datalayer" parent="@android:style/Widget.Holo.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_datalayer</item>
</style>

<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Datalayer.Widget" parent="@android:style/Theme.Holo">
    <item name="android:popupMenuStyle">@style/PopupMenu.Datalayer</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Datalayer</item>
</style>

    
asked by anonymous 28.08.2014 / 20:12

2 answers

1

To solve the problem completely, using the ActionBar Style Generator , the Base Theme as Light - Dark Action Bar and overwrite the theme you are using. This way the styles of ActionBar elements will be homogeneous and there will be no more problems.

As a way to periodically stylize some items, such as the Overflow Menu icon and the title and subtitle style of ActionBar , I recommend the styles below.

To change drawable relative to Overflow Menu , simply add this style rule to your theme:

<style name="Theme.Datalayer" parent="@android:style/Theme.Holo.Light">
    <!-- Demais regras omitidas -->

    <!-- SDK 14+ -->
    <item name="android:actionOverflowButtonStyle">@style/Theme.Datalayer.OverFlow</item>
    <!-- Se usar alguma impl. de actionbar de compatibilidade. e.g: AppCompat
    <item name="actionOverflowButtonStyle">@style/Theme.Datalayer.OverFlow</item>
</style>

<style name="Theme.Datalayer.OverFlow" parent="@android:style/Widget.Holo.Light.ActionButton.Overflow">
    <item name="android:src">@drawable/seu_drawable</item>
</style>

Try to generate the icons from Roman Nurik's Android Asset Studio - Icon Generator from the Roman Nurik or on the fork shreyasachar with updated Material Design icons.

To change the title is simpler because it is already redefining the style of the title, just change the color. Change your style MyTheme.ActionBar.TitleTextStyle like this:

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <!-- Altere a cor abaixo -->
    <item name="android:textColor">@color/action_bar_text</item>
    <!-- Altere a cor abaixo, acredito que essa regra nao eh necessaria -->
    <item name="android:actionMenuTextColor">@color/action_bar_text</item>
    <!-- Altere a cor abaixo, acredito que essa regra nao eh necessaria -->
    <item name="android:titleTextStyle">@color/action_bar_text</item>
</style>

You still have to change the subtitle color if you need to: Ai will have to do analogous to the style of the title:

<style name="Theme.Datalayer" parent="@android:style/Theme.Holo.Light">
    <!-- Demais regras omitidas -->
    <!-- Acrescente a regra abaixo -->
    <item name="android:subtitleTextStyle">@style/MyTheme.ActionBar.SubTitleTextStyle</item>
</style>

<!-- Crie este estilo -->
<style name="MyTheme.ActionBar.SubTitleTextStyle" parent="@android:style/TextAppearance.TextAppearance.Holo.Widget.ActionBar.Subtitle">
    <!-- Altere a cor abaixo -->
    <item name="android:textColor">@color/action_bar_text</item>
    <!-- Altere a cor abaixo, acredito que essa regra nao eh necessaria -->
    <item name="android:actionMenuTextColor">@color/action_bar_text</item>
    <!-- Altere a cor abaixo, acredito que essa regra nao eh necessaria -->
    <item name="android:subtitleTextStyle">@color/action_bar_text</item>
</style>
    
28.08.2014 / 20:49
0

Solved! Here's the xml change:

        drawable / selectable_background_datalayer         @ style / PopupMenu.Datalayer         @ style / DropDownListView.Datalayer         @ style / ActionBarTabStyle.Datalayer         @ style / DropDownNav.Datalayer         @ style / ActionBar.Solid.Datalayer         drawable / cab_background_top_datalayer         drawable / cab_background_bottom_datalayer         @ style / ActionButton.CloseMode.Datalayer         color                  @ style / Theme.Datalayer.Widget         @ style / TextAppearance     

<style name="TextAppearance">
    <item name="android:textColor">@android:color/black</item>
</style>
    
29.08.2014 / 17:54