How can i change NavigationView menu item text color.My menu.xml file is, i also write
app:itemIconTint="@color/white" app:itemTextColor="@color/white" in my layout but it will not work
<?xml version="1.0" encoding="utf-8"?>
<item
android:checked="false"
android:title="@string/popular">
<menu>
<item
android:id="@+id/tag1"
android:checked="false"
android:icon="@drawable/bird"
android:title="@string/tag1" />
<item
android:id="@+id/tag2"
android:checked="false"
android:icon="@drawable/rabbit"
android:title="@string/tag2" />
<item
android:id="@+id/tag3"
android:checked="false"
android:icon="@drawable/bird"
android:title="@string/tag3" />
<item
android:id="@+id/tag4"
android:checked="false"
android:icon="@drawable/rabbit"
android:title="@string/tag4" />
<item
android:id="@+id/tag5"
android:checked="false"
android:icon="@drawable/bird"
android:title="@string/tag5" />
<item
android:id="@+id/setting"
android:checked="false"
android:icon="@drawable/setting"
android:title="@string/setting" />
<item
android:id="@+id/rate"
android:checked="false"
android:icon="@drawable/rating"
android:title="@string/rate" />
</menu>
</item>
my NavigationView like..
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/theme_primary"
app:headerLayout="@layout/layout_drawer_header"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:menu="@menu/menu_main" />
thanks for the response, i just search little and i found the answer there is no any style changes, i just change in JAVA file like and it's done.
NavigationView navigation_view = (NavigationView) findViewById(R.id.navigation_view);
navigation_view.setItemTextColor(ColorStateList.valueOf(Color.BLACK));
navigation_view.setItemIconTintList(null);
NavigationView
uses the color of Widget.Design.NavigationView
theme.
You can override that theme like following.
Create your own style which overridesWidget.Design.NavigationView
in your style.xml:
<style name="NavigationStyle" parent="Widget.Design.NavigationView">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
</style>
Use that theme in your layout xml file:
<android.support.design.widget.NavigationView
...
android:theme="@style/NavigationStyle"
... />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With