如何更改工具栏菜单项的文字颜色?
问题描述:
我已经看到了很多有关同一问题的解决方案。但没有解决方案为我工作。如何更改工具栏菜单项的文字颜色?
这是在工具栏中更改菜单项文本颜色的最佳解决方案。
虽然定义新样式扩展“AppTheme.AppBarOverlay”而不是“Theme.AppCompat.Light.DarkActionBar”。 这不仅会更改菜单项的文字颜色,还会保留导航图标的默认颜色。
styles.xml
<style name="myCustomMenuTextApearance" parent="AppTheme.AppBarOverlay">
<item name="actionMenuTextColor">@color/colorAccent</item>
工具栏
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
android:background="?attr/colorPrimary"
android:theme="@style/myCustomMenuTextApearance"
app:popupTheme="@style/AppTheme.PopupOverlay" />
答
使用您的主题文件menu.xml文件,因为所有你想要你的工具栏中添加项目在这里。我想,你可以使用项目的属性色调来改变方面的颜色。
所以你回答这个问题? :P –
可能的重复http://stackoverflow.com/questions/18015010/action-bar-menu-item-text-color –
什么问题?它很好地直接回答。 –