Change the Navigationdrawer menu color?

Asked

Viewed 1,481 times

0

Change the Navigationdrawer menu color, the one that Oce pulls up a drawer and brings up the menu ![inserir a descrição da imagem aqui]1

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 codification 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 it is to post one of the 2 the same ideal is code because sometimes the error is programming ...

1

You mean the entire menu or only this image that is at the top?

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

    <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 top layout you should go on main_header (or the name you have given, is the layout that the app:headerLayout receive) and modify it as you want, you can change the color of the whole Layout 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: https://developer.android.com/samples/GridViewPager/res/drawable/gradient.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.