Navigation Drawer customized and colorful

Asked

Viewed 314 times

4

Hello, what I wanted to do was to be able to put colorful icons in the navigation, as I can do this?

The images I have in my project are colorful but in navigation they only turn gray like this. I appreciate the help.

inserir a descrição da imagem aqui

2 answers

2


In the onCreate() of his ActivityMain puts the code below:

NavigationView navigationView = findViewById(R.id.nav_view); // Aqui com certeza você já faz
// A linha abaixo permite você visualizar os icones com outras cores sem ser a cor padrão
navigationView.setItemIconTintList(null);

You will see the result once you start the application.

inserir a descrição da imagem aqui

  • 1

    I had put a wrong line of code and now fixed it. It solves your problem?

  • You saved my life!!!! Thank you very much!!!!

1

  1. Add the color to your navigation view activity_main.xml: app:itemIconTint="@android:color/blue"

The default hue is black, but you can use an even darker shade of black using # 000000

<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:itemIconTint="#000000"
app:menu="@menu/activity_main_drawer" />

Translated from

  • that’s not quite what I wanted, I want the colorful icons

Browser other questions tagged

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