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

本秂侑毒 提交于 2021-02-09 02:45:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!