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);
}