Change the color of the NavigationDrawer menu?

0

Change the color of the NavigationDrawer menu, the one you pull a drawer and the menu ]1

    
asked by anonymous 23.03.2017 / 21:13

2 answers

1

    android:background="#000" --> cor de fundo
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    app:headerLayout="@layout/header"
    app:itemTextColor="your color" --> cor dos itens do seu drawer
    app:menu="@menu/drawer" />

In coding it would be like this

private DrawerLayout mDrawerLayout;
private Text itemdrawer;
mDrawerLayout.setBackgroundResource(// sua cor aqui dentro);
itemdrawer.setBackgroundResource(// sua cor aqui dentro);

Note: It would be very interesting to always post codes and not only images ... if you are going to post one of the 2 the ideal is even code because sometimes the error is programming ...

    
23.03.2017 / 21:17
1

Do you mean the entire menu or just that image at the top?

To change the color of the options of NavigationDrawer (where it is currently white) you can go to .xml and set its background color:

    <android.support.design.widget.NavigationView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#000000" (aqui será a cor do background)
        app:menu="@menu/menu" (aqui o menu onde ficará as opções)
        app:headerLayout="@layout/main_header"/> (aqui o layout que fica na parte superior) 

If you want to change the color of the upper layout you must go in main_header (or the name you have given, the layout that app:headerLayout receives) and modify it as you like, you can change the Layout color all over if you want:

    main_header.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="160dp"
       android:background="" (cor do main_header aqui, caso queira uma cor gradiente você deve fazer um drawable e definir ele como background, ou pode colocar uma imagem também)
       ...>
    </LinearLayout>

How to use gradient colors here explains: link

    
26.11.2017 / 16:11