toolbar 背景色更改和标题颜色的更改 网上众说纷纭
关于背景色更改很多人觉得改 colorPrimary色值,但是colorPrimary色值更改会牵扯所有与默认色的更改
其实只需要在toolbar里面改background即可
字体的更改 失败的方法:
1.toolbar : android:titletextColor
2.style 中 menu字体颜色
3.style中 textColorPrimary
有效又简单的方法:toolbar:titleTextColor 即可 定义toolbar
xmlns:toolbar="http://schemas.android.com/apk/res-auto"
<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/main_bg" app:elevation="0dp" toolbar:titleTextColor="@color/toolbar_text" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout>