简体   繁体   English

如何更改导航抽屉android的背景颜色?

[英]How to change the background color of navigation drawer android?

I want to make my navigation drawer for dark mode but I can't find where I have to change the code.我想为暗模式制作导航抽屉,但找不到必须更改代码的位置。 This pic will help you understand my question这张照片将帮助你理解我的问题

在此处输入图片说明

how to change the color to black and also how to change the text color to white?如何将颜色更改为黑色以及如何将文本颜色更改为白色?

Actually, this is a layout for the navigation activity and in the XML file we can edit it.实际上,这是导航活动的布局,我们可以在 XML 文件中对其进行编辑。

 <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/motivationQuoteColor"  HERE IS THE CHANGE I NEED TO DO
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_front_navigation"
        app:itemTextColor="#000000"
        app:menu="@menu/activity_front_navigation_drawer">

    </com.google.android.material.navigation.NavigationView>

summary, go to that activity where we slide left to right then the drawer opens, then open the layout file, and then you have to go to the code above and then change the code there.总结,转到我们从左向右滑动的那个活动,然后抽屉打开,然后打开布局文件,然后你必须转到上面的代码,然后在那里更改代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM