问题
Using the Design Support Library version 23.0.1
, menu items within the NavigationView appear to, by the default, support the ripple animation when selected. However, when upgraded to Design Support Library version 23.1.0
the ripple animation appears to be lost. Is this a bug? Has anyone else noticed this as well and can replicate it? And, better yet, does anyone have a solution?
I first discovered this issue while utilizing the NavigationView
via Design Support Library version 23.4.0
and noticed a lack of the ripple effect on menu items. However, it wasn't until I followed this NavigationView
tutorial, provided by AndroidForDevs, that I was able to place blame on Design Support Library version 23.1.0
.
To replicate and reproduce the issue, checkout this tutorial's sample code, which utilizes Design Support Library version 22.2.0
, and bump the version to 23.1.0
in the app's build.gradle. You'll then notice the menu items do not ripple when selected. However, if you revert back to version 22.2.0
or 23.0.1
you'll notice the items ripple when selected.
For reference, here is a link to the Support Library change log. While it mentions an update allowing for custom views within the NavigationView
I can't think of why this might have led to the removal of the ripple effect by default as it sounds unrelated. Here is change description word-for-word
Added support for custom views to the NavigationView class by using the
app:actionLayout
attribute orMenuItemCompat.setActionView()
method.
Note: This issue is most easily visualized when the drawer is prevented from closing when a menu item is selected. This can be achieved by commenting this line
来源:https://stackoverflow.com/questions/37796870/navigationview-ripple-lost-in-support-library-23-1-0-update