0

I'm using 25.3.1 support library. I have Fragment in my app with setHasOptionsMenu(true). After menu has been inflated, menu icons does not accept color from styles, they stay black (as original vector resource) instead of my text color as I wrote in styles. What am I doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/app_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    >

  <android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="?actionBarSize"
      android:background="@color/toolbarBackgroundColor"
      android:theme="@style/AppTheme.Toolbar"
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
      />
</android.support.design.widget.AppBarLayout>

Here is toolbar style:

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  ...
  </style>

  <style name="AppTheme.Toolbar" parent="Base.ThemeOverlay.AppCompat.ActionBar">
    <item name="colorAccent">@color/colorAccent</item>
    <item name="actionMenuTextColor">@color/textColor</item>
    <item name="android:textColorPrimary">@color/textColor</item>
    <item name="android:textColorSecondary">@color/textColor</item>
  </style>

And here is my code from Fragment

  @Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    mTopLevelModeEnabled = true;
  }

  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.order_menu, menu);
  }
Near1999
  • 1,547
  • 2
  • 18
  • 37
  • Can you post a screenshot with actual and desired behavior? – azizbekian May 13 '17 at 11:19
  • @azizbekian, unfortunately, no. But I can explain. I have black icons in my drawables folder. My textColor is light gray. Toolbar title, home icon and menu items without icon (just text) is light gray except menu items with icon attribute, they are black – Near1999 May 13 '17 at 11:26
  • This may be relevant: http://stackoverflow.com/questions/28219178/toolbar-icon-tinting-on-android – rciovati May 21 '17 at 09:32

0 Answers0