Color icons in navigation drawer?

0

How can I put color icons in the navigation drawer such as Google apps that take their colors; I tried but when I put a custom icon it gets gray and does not take the original color, I tried declaring the attribute in the navigationview (setIconItemTintList) but they are all in the same color and I want them to take their own color

    
asked by Juan Solano 05.04.2017 в 23:39
source

2 answers

0

You have to modify your NavigationView, it is located by default in the activity_main.xml, in this view you should add:

app:itemIconTint="@color/el_color_que_prefieras"

And it would be like that

<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:menu="@menu/activity_main_drawer"
    app:itemIconTint="@color/el_color_que_prefieras"/>
    
answered by 06.04.2017 / 16:59
source
1

Maybe you already know the answer to this question, but I just found out and wanted to share, the only thing you have to do is add this line:

navigationView.setItemIconTintList(null);

In the onCreate of the activity_main and the icons will remain with the original colors, greetings.

    
answered by 09.02.2018 в 20:18