Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android L ripple effect not displayed

Tags:

android

I've created a RecyclerView and set up an onItemClickListener to show an Activity, an AlertDialog or a Fragment. When I click to display the Activity or the Alert, it shows the ripple effect, but when I click on to display a Fragment, it doesn't. How can I make the ripple effect show when clicking on the Fragment list item?

Here's a link to my source if you're interested.

like image 905
taylordurden Avatar asked Dec 29 '25 02:12

taylordurden


1 Answers

Replacing a fragment is an instantaneous action, displaying an alert is delayed. The ripple animation happens while the alert is being displayed with the default fade-in animation as they're both playing at the same time; but not when changing fragments because there's no time for it.

You can try delaying replacing your fragment by means of an empty animation or a Timer thread.

Another option is adding an animation to the fragment transaction in a way that it allows for the ripple animation to finish.

like image 101
MLProgrammer-CiM Avatar answered Dec 30 '25 16:12

MLProgrammer-CiM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!