Riyaz Ahamed
Riyaz Ahamed

Reputation: 802

Customising Navigation View in Android support library

I am trying to implement navigation view using support library. Using primary color, the selected menu in navigation drawer is highlighted. But I want to remove the highlighted background of the selected item.

enter image description here

Upvotes: 1

Views: 598

Answers (1)

Pfennigbaum
Pfennigbaum

Reputation: 366

add <item name="colorControlHighlight">@color/yourColor</item>
 to your Theme (in style.xml) and it will change the grey color.

setting the Color to @android:color/transparent will solve your problem.

If you want to change the BackgroundColor when item is selected or pressed create a selector as a drawable and add <item name="android:selectableItemBackground">@drawable/row_selector</item> to the Theme

the selector (row_selector) could look somthing like this:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_selected="true" android:drawable="@drawable/selected_gray"/>
   <item android:state_pressed="true" android:drawable="@drawable/pressed_gray"/>
</selector>

Upvotes: 4

Related Questions