0

I've been trying to work with the new Toolbar and style the overflow menu without much luck.

Currently the overflow menu is showing as white text with an off-white background.

enter image description here

I would like to change the overflow menu text colour without affecting the Title and Subtitle in the Toolbar.

toolbar.xml

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android" android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ActionBarCustomTheme"
    android:popupTheme="@style/popupNew"
    android:background="@color/primary_color"
    />

style.xml

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>

    <item name="colorPrimary">@color/primary_color</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="popupMenuStyle">@style/popupNew</item>
</style>

<style name="ActionBarCustomTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>

    <item name="colorPrimary">@color/primary_color</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>

    <item name="android:textColorPrimary">@color/text_icons</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="colorControlNormal">@color/text_icons</item>

    <item name="android:textColorSecondary">@color/text_icons</item>
    <item name="actionMenuTextColor">@color/primary_text</item>
</style>


<style name="popupNew" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:textColor">@color/primary_text</item>
</style>

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@color/text_icons</item>
</style>

Osborne Cox
  • 466
  • 2
  • 7
  • 19

2 Answers2

0

Try to change your popup theme to the following:

<style name="popupNew" parent="ThemeOverlay.AppCompat.Dark">
    <item name="android:textColor">@color/primary_text</item>
</style>

You may check this answer for details.

Community
  • 1
  • 1
makovkastar
  • 5,000
  • 2
  • 30
  • 50
0

I finally figured this out. It just took one additional line under the ActionBarCustomTheme:

    <item name="android:textColor">@color/primary_text</item>

It's a bit confusing as there is a property called textColorPrimary which has already been set but this property doesn't seem to affect the overflow menu.

Osborne Cox
  • 466
  • 2
  • 7
  • 19