Android Toolbar menu text color

Євген Гарастович picture Євген Гарастович · Apr 7, 2017 · Viewed 11.4k times · Source

I'm trying to change my Toolbar's menu item text color here, but it doesn't work. Here's my style:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="toolbarStyle">@style/AppTheme.ToolbarStyle</item>
    <item name="buttonStyle">@style/AppTheme.ButtonStyle</item>
    <item name="colorControlHighlight">@color/colorPrimary</item>
</style>
<style name="AppTheme.ToolbarStyle" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <item name="android:background">@color/colorPrimary</item>
    <item name="titleTextColor">@android:color/white</item>
    <item name="titleTextAppearance">@style/TextAppearance.AppCompat.Widget.ActionBar.Title
    </item>
    <item name="actionMenuTextColor">@android:color/white</item>
</style>

layout xml:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:title="@string/app_name"
    app:titleMarginStart="@dimen/margin_l"
    />

I have tried to set the Toolbar theme directly in xml, but the menu item is still back. Is there a solution to this?

enter image description here

Answer

Abid Khan picture Abid Khan · Apr 7, 2017

Add these lines in your AppTheme style

<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>