<androidx.appcompat.widget.Toolbar
style="@style/ToolbarStyle"
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:theme="@style/ToolbarTheme"
app:navigationIcon="@drawable/ic_menu_back"
app:popupTheme="@style/TooolbarPopTheme"
app:titleTextColor="@android:color/white" />
如果只是修改背景,而不修改弹出背景应该直接在xml中或者再 style中定义,而不应该在 theme 引用中定义
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Light">
<item name="colorControlNormal">@color/white_no_night</item>
</style>
<style name="ToolbarStyle">
<item name="android:background">?attr/defaultThemeColor</item>
</style>
<style name="TooolbarPopTheme">
<item name="actionOverflowButtonStyle">@style/Widget.AppCompat.PopupMenu.Overflow</item>
</style>