I have an application with a navigation drawer in it. The layout of the drawer has a specific background color, but the items in it need to have another color. So i added an adapter to fill the list items into the navigationdrawer with another background, what works like a charm. Next I wanted to add a ripple effect to the list items if they get clicked. I read that it's possible to use the following lines to add a ripple effect and a background color.
android:background="@color/navigation_drawer_main_bg"
android:foreground="?attr/selectableItemBackground"
This works fine on my test device with Android 7.1.2 (background is right and ripple effect is there, yay), but on my devixe with Android 5.1.1 there is no ripple effect. Does anyone know a fast solution how the get the ripple effect to my lower api devices without loosing my background color?
Thanks in advance.
Found a solution for me:
android:background="?attr/selectableItemBackground"
Solution: NavigationDrawer ListItem has background color and ripple effect, yay.