简体   繁体   English

如何在棒棒糖中长按按钮时禁用涟漪效应?

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

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 .当使用 Sherlock 长按按钮时没有显示涟漪效果,但是当我使用 appcompat 时,它会在单击和长按按钮时显示涟漪效果。 I do not want any ripple effect on the press of a button我不希望按下按钮时产生任何涟漪效应

If you are using MaterialButton , then set app:rippleColor :如果您使用MaterialButton ,则设置app:rippleColor

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

Thanks to this and this answer.感谢这个这个答案。

If you have root, have a look at my patch here https://github.com/luv/android5_noripple如果您有 root,请在此处查看我的补丁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.我的补丁只是将 android.graphics.drawable.Ripple 中的 draw 函数替换为一个只返回 True 的函数。

You need to fetch /system/framework/framework.jar from your phone, patch it, and push it back (you need root for this).您需要从手机中获取 /system/framework/framework.jar,对其进行修补,然后将其推回(为此您需要 root)。 See the link for step-by-step instructions.有关分步说明,请参阅链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM