Replace Navigation View Item Ripple Effect
I am attempting to replace what I thought was the default item background of the NavigationView. So I created a drawable to replace the background and applied it using the itemBack
Solution 1:
I have already answered this question here
Note: This code just removes the opacity of background default ripple
Anyways, I'll answer it again here.
Assuming your NavigationView code is:
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_gravity="start"app:menu="@menu/your_menu"app:itemBackground="@drawable/background_navigation_view_item.xml"/>
What I've done is, added a theme attribute as follows to the NavigationView:
android:theme="@style/NavigationItemNoRipple"
In styles.xml:
<stylename="NavigationItemNoRipple"><itemname="android:colorControlHighlight">@android:color/transparent</item></style>
Post a Comment for "Replace Navigation View Item Ripple Effect"