0

I am trying to set the Action Bar text color to black in a Theme.AppCompat.Light.DarkActionBar, but the text color stays white.

Below is my styles resource

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowBackground">@android:color/white</item>
    <item name="android:actionBarStyle">@style/ActionBar</item>
</style>

<style name="ActionBar" parent="@android:style/Widget.ActionBar">
    <item name="android:titleTextStyle">@style/ActionBar.Title</item>
    <item name="android:subtitleTextStyle">@style/ActionBar.Subtitle</item>
</style>

<style name="ActionBar.Title">
    <item name="android:textColor">@color/black</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="ActionBar.Subtitle">
    <item name="android:textColor">@color/black</item>
</style>
<style name="AppTheme.AppBarOverlay"        parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

I also added

        android:titleTextColor="@color/black"
        android:subtitleTextColor="@color/black"

in the

That did not work.

I tried the answer in Changing Background and text color of AppCompat Light DarkActionBar Theme on android that did also not work.

Can the Title color be set in this theme, or do I need to change to a different theme?

Community
  • 1
  • 1
Tori
  • 1,358
  • 4
  • 19
  • 38

1 Answers1

2

I had the same problem changing the toolbar text color. The solution was setting the android:textColorPrimary.

Try this:

<style name="ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="android:textColorPrimary">@color/red</item>
</style>

And then add android:theme="@style/ActionBar" to your Toolbar.

Florin Birgu
  • 495
  • 7
  • 12