6

How to disable ripple effect on long press of a button in lollipop?

When using sherlock long press of a button is not showing ripple effect but when i use appcompat it is showing a ripple effect on click and also on long click of a button . I do not want any ripple effect on the press of a button

Mahozad
  • 18,032
  • 13
  • 118
  • 133
ravi pradeep
  • 161
  • 1
  • 2

2 Answers2

5

If you are using MaterialButton, then set app:rippleColor:

<com.google.android.material.button.MaterialButton
    ...
    app:rippleColor="@android:color/transparent" />

Thanks to this and this answer for their help.

Mahozad
  • 18,032
  • 13
  • 118
  • 133
-1

If you have root, have a look at my patch here https://github.com/luv/android5_noripple

My patch simply replaces draw function in android.graphics.drawable.Ripple with a function that does nothing but returns True.

You need to fetch /system/framework/framework.jar from your phone, patch it, and push it back (you need root for this). See the link for step-by-step instructions.

luv
  • 432
  • 4
  • 6
  • The link is broken, please include excerpts when posting solutions from a remote source. That way the solution will still be available for future readers. – Omnibyte Jun 07 '22 at 11:06