set navaigation Item text color white android

434 views Asked by At

I want to set navigation menu text color to white how can able do it?? I want to make screen like this

Please check my following code snippet

My Navigation Menu Looks Like:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
>
    <item
        android:id="@+id/nav_timer"
        android:icon="@drawable/ic_av_timer_black_36dp"
        android:title="Timer"
        android:textColor="#000000"
        />
    <item
        android:id="@+id/nav_profile"
        android:icon="@drawable/ic_account_circle_black_48dp"
        android:title="Profile"
        >@color/menuColor</item>
    <item
        android:id="@+id/nav_logs"
        android:icon="@drawable/ic_assignment_black_48dp"
        android:title="Logs" />
    <item
        android:id="@+id/nav_changeBusiness"
        android:icon="@drawable/ic_business_black_48dp"
        android:title="Change Business" />
    <item
        android:id="@+id/nav_logout"
        android:icon="@drawable/ic_exit_to_app_black_48dp"
        android:title="Logout" />

2

There are 2 answers

0
Sneha Sarkar On BEST ANSWER

Add app:itemTextColor="@android:color/white" in your navigation view.

<android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:itemTextColor="@android:color/white"
            android:fitsSystemWindows="true"
            app:menu="@menu/act_home_drawer_menu"
             />

It will give you desired result.

0
Sanat Pandey On

You can add a Listview under Navihation View. And then you can add your custom adapter with textview.

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

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/content_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include layout="@layout/main_toolbar" />

    </FrameLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"/>

        <ListView
            android:id="@+id/menuList"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</android.support.v4.widget.DrawerLayout>

This will solve your problem. It worked for me.