我试图在这里更改我的工具栏的菜单项文本颜色,但它不起作用.这是我的风格:
<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"
/>
我试图直接在xml中设置工具栏主题,但菜单项仍然回来了.这个问题有方法解决吗?
解决方法:
在AppTheme风格中添加这些行
<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>