问题
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
回答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.
回答2:
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.
来源:https://stackoverflow.com/questions/31263828/how-to-disable-ripple-effect-on-long-press-of-a-button-in-lollipop