I want to change the background color of the last item of the navigation drawer menu, i implemented a selector so if state_last is true the color is red, otherwise, white, but it looks like that state_last is always false, here is the selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_last="true" android:drawable="@android:color/holo_red_dark" />
<item android:state_last="false" android:drawable="@android:color/white" />
</selector>
here is the navigation code
<com.google.android.material.navigation.NavigationView
android:id="@+id/navView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/nav_menu"
app:headerLayout="@layout/header"
android:background="@color/blue1"
app:itemTextColor="@color/blue1"
app:itemBackground="@drawable/menu_item_background_color"
app:itemIconTint="@color/blue1"
/>
i also tried to setActionView but also doesn't work, something else, is there a way other than adding empty items to make the last item in the end of the drawer?
question from:
https://stackoverflow.com/questions/65932179/state-last-selectors-attribute-doesnt-work-in-navigation-drawer 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…