抽屉布局颜色不变

Drawer layout color not changing

尝试将导航抽屉颜色更改为 colorPrimary,但抽屉布局颜色没有改变,即使它设置为 colorPrimary.It 在 Android Studio 上显示,但在实际 运行 上显示设置为白色。!

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:padding="0dp"
android:paddingBottom="0dp"
tools:openDrawer="start">

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:itemBackground="@color/colorPrimary" />

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:itemBackground="@color/colorPrimary"
    app:itemIconTint="@android:color/background_light"
    app:itemTextColor="@android:color/background_light"
    app:menu="@menu/activity_main_drawer">

</android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>

检查这个

试试这个代码..

<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/navigation_drawer_header"
app:menu="@menu/menu_drawer"
android:background="@color/color_navigation_list_background"
app:itemIconTint="@color/color_selector_navigation_item"
app:itemTextColor="@color/color_selector_navigation_item"/>