2

My items are not showing the Ripple Effect when I click in any recyclerView item if I don't add this code:

@Override
public void onItemClick(final RecyclerView parent, final View view, final int position, final long id)
    ViewCompat.postOnAnimationDelayed(parent, new Runnable() {
        @Override
        public void run() {
            // Your click code goes here
        }
    }, 50);
}

I got this code from here: RIpple effect on RecyclerView not working on light tap

Without that code if I keep pressing the animation appears, it is just dissapearing with single taps.

BTW, this is only a patch that is slowing the app.

EDIT: my recyclerview is inside a fragment.

Is there a way to fix this problem without it?

JavierSegoviaCordoba
  • 6,531
  • 9
  • 37
  • 51
  • 1
    Shot in the dark but its happened to me before. You dont have animations turned off or sped up in the developer settings of the device do you? – Devsil Aug 15 '17 at 17:56
  • @Devsil nop, all options by default, the rest of animations are working perfectly. – JavierSegoviaCordoba Aug 15 '17 at 18:01
  • Have you added this in your xmls - `android:background="?attr/selectableItemBackground` – randy Aug 15 '17 at 20:17
  • Yes, the ripples appears if I use postanimation. The problem is if I don't use it, the action stops the animation. Is there a way that animation keeps running at same time that the action is triggered and is running? – JavierSegoviaCordoba Aug 16 '17 at 19:02

0 Answers0