更换ToolBar系统后退键
在ToolBar下添加下面3行
xmlns:app="http://schemas.android.com/apk/res-auto" app:navigationIcon="@mipmap/ic_back" android:navigationIcon="@mipmap/ic_back"
ToolBar修改menu item的字体颜色
在你的样式文件中定义如下style
[html] view plain copy <style name="AppTheme.ActionBar" parent="Theme.AppCompat.Light.DarkActionBar"> ... <item name="actionMenuTextColor">@color/text_color</item> ... </style> 然后在你的ToolBar中引用上述style,就像这样 [html] view plain copy <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:layout_gravity="top" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" android:theme="@style/AppTheme.ActionBar"/>最后,该大神再次提示:Android:theme="@style/AppTheme.ActionBar", don't forget this line in your toolbar
靠谱
发现一个问题,在之后修改menu字体大小的时候,又出现了不管用的现象,仔细对比发现如下不同
[html] view plain copy <!-- 我这定义name时加上了android:,结果不管用 --> <item name="android:actionMenuTextAppearance">@style/WhiteMenuTextAppearance</item> <!-- 之后去掉android:,管用了 --> <item name="actionMenuTextAppearance">@style/WhiteMenuTextAppearance</item>哪位大神能告知下,加与不加的区别在哪呢
发现第二个问题,更改字体颜色和大小后,之有显示在ToolBar中才起作用,设置app:showAsAction="never"收在more按钮中并不起作用