I'm trying to figure out a way to have a vertical line on the selected item in my NavigationView. I was trying to set it through the xml setting as so:
app:itemBackground="@drawable/nav_selected_item"
But this just applies the drawable to the entire list of menu items.
This is my drawer:
<android.support.design.widget.NavigationView
android:id="@+id/nav_drawer"
android:layout_width="270dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@color/primary_blue"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_drawer_header"
app:itemBackground="@drawable/nav_drawer_selected"
app:menu="@menu/nav_drawer_view" />
The default behavior (when itemBackground attr isn't set to nav_drawer_selected) current puts a transparent lighter shade over only the selected item. When I do set it, it doesn't have that behavior anymore. Is the default itemBackground using a selector? How would I approach this effectively? I just want to have one item use my drawable, if it's selected/currently in view, not apply the whole style to the entire list.
Thanks!
Aucun commentaire:
Enregistrer un commentaire