Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android spinner does not have ripple on button itself, just its options

I can't seem to get the pressed state ripple to work on a Spinner. The individual drop down items have the ripple, but not the spinner itself. I thought maybe this was expected behavior, but this animation from the material design guidelines clearly shows the spinner with a pressed state ripple before the options drop dropdown appears.

https://material-design.storage.googleapis.com/publish/material_v_4/material_ext_publish/0B3321sZLoP_HTS1LdnhrTl9TRzg/components-buttons-otherbuttons-060203_MobileDropdowns_xhdpi_006.webm

like image 379
Darren Hinderer Avatar asked Oct 31 '22 17:10

Darren Hinderer


1 Answers

I created a new Spinner in an Activity and as you described, the RippleDrawable is not applied to the Spinner using the v7 compatibility library or on Android 5.0+. This isn't surprising to me; Google often fails to implement its own design.

To have the affect, all I did was create a RippleDrawable in res/values-v21/ and set that to be the background on the Spinner using spinner.setBackgroundResource(R.drawable.spinner_background);. I'm sure you can also set this in your theme.

like image 162
Jared Rummler Avatar answered Nov 08 '22 06:11

Jared Rummler