Federick Jons Federick Jons - 2 months ago 11
Android Question

nav_menu with blue icon items displaying white

In nav_menu.xml I have a list of icons to show in NavigationView.
The problem is that the icons are linked with the drawable folder and those icons are BLUE, but when I debug the app in the navigation show me white.

base.xml

<android.support.design.widget.NavigationView
android:id="@+id/lista"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="@color/gris"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="10sp"
android:choiceMode="singleChoice"
app:itemTextColor="@color/azulOscuro"
app:headerLayout="@layout/nav_header"

app:menu="@menu/nav_menu"/>


nav_menu.xml

<?xml version="1.0" encoding="utf-8"?>




<group android:checkableBehavior="single">

<item
android:id="@+id/profile"
android:icon="@drawable/ic_action_blue"
android:title="@string/title"/>

<item
android:id="@+id/configuration_section"
android:title="Example">

<menu>
<item
android:id="@+id/example2"
android:icon="@drawable/ic_maps_blue"
android:title="@string/title"/>

<item
android:id="@+id/example3"
android:icon="@drawable/ic_maps_blue"
android:title="@string/title"/>

...
...
</menu>


May be you can help me. Thanks

Answer

use ur colour drawble images in item tags and in your code try this

// add normal color to navigationView
navigationView.setItemIconTintList(null);

also you can do it using xml try this

<android.support.design.widget.NavigationView
    ...
    app:itemIconTint="@android:color/black" 
    ... />

or

 app:itemIconTint="@null"
Comments