1

I am working on making a navigation drawer in a project of mine and cant seem to figure out how to change the color the item bar changes to when pressed or clicked on. It keeps changed to orange when I want to to be either transparent(non existent), tinted, or a different color and for the text to show through. I have tried changing the background, it ignores backgrounds for when state is checked and almost acts as a layer ontop of everything.

How it looks unclicked

How it looks clicked or held down

This is my navigation_menu with the items

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<group android:checkableBehavior="single">

    <item android:id="@+id/news"
        android:title="News"
        android:icon="@mipmap/ic_content_paste_black_24dp"
        android:checkable="false"/>

    <item android:id="@+id/account"
        android:icon="@mipmap/ic_picture_in_picture_black_24dp"
        android:title="Account"
        android:checkable="false"/>
</group>

<group android:checkableBehavior="single">
    <item android:id="@+id/help"
        android:icon="@mipmap/ic_help_outline_black_24dp"
        android:title="Help"
        android:checkable="false"/>
</group>

And this is my navigation View

<android.support.design.widget.NavigationView
    android:id="@+id/nav_menu"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="#2a2a2a"
    app:menu="@menu/navigation_menu"
    android:layout_gravity="start"
    app:headerLayout="@layout/navigation_header"
    app:itemTextColor="#ffffff"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

</android.support.design.widget.NavigationView>

Any help or a point in the right direction would be much appreciated!

Modest
  • 53
  • 1
  • 7
  • Search before post an answer https://stackoverflow.com/questions/30594025/how-to-customize-item-background-and-item-text-color-inside-navigationview – Romadro Sep 30 '17 at 21:29
  • Possible duplicate of [How to customize item background and item text color inside NavigationView?](https://stackoverflow.com/questions/30594025/how-to-customize-item-background-and-item-text-color-inside-navigationview) – Romadro Sep 30 '17 at 21:29
  • I've tried this before, it doesn't work for what im trying to change. When I click on one of the items the entire bar goes a different color (orange), can't tell what color the background goes bc its covered by the orange. its almost like a new layer or something appears ontop. – Modest Sep 30 '17 at 22:14
  • but in your code you even don't use selectors for item text color and don't set anything to itemBackground. Do it as described in that link above. Use selectors and set all values correctly and you will be suprised – Romadro Oct 01 '17 at 06:21
  • update: ive tried this multiple times now (everything listed in the link). this does not fix my problem. – Modest Oct 04 '17 at 03:52

0 Answers0