?attr/selectableItemBackground效果仅在长按时显示 [英] ?attr/selectableItemBackground effect shows only on longtap

查看:111
本文介绍了?attr/selectableItemBackground效果仅在长按时显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到属性?attr/selectableItemBackground创建的效果仅在我长按视图时才会显示.但我希望它能在每次点击时显示.

I've noticed that the effect created by the attribute ?attr/selectableItemBackground only shows when I long tap the view. But I want it to be shown on every tap.

视图是可单击的,并且具有单击侦听器.

View is clickable and has on click listener.

该怎么做?

推荐答案

我注意到棒棒糖和棉花糖之间的行为发生了变化:

I've noticed there was a change in the behavior between Lollipop and Marshmallow:

  • 棒棒糖-它会在媒体上引起涟漪.
  • 棉花糖-波纹从释放开始.

可能是问题所在吗?

我会坚持使用设备Look&感觉但是你可以 尝试以下建议的解决方案:

I would stick to the device Look & Feel but you could try this suggested solution:

https://stackoverflow.com/a/34167312/348378

或者改用一个库,也许像这样:

Or use instead a library instead, maybe like this one:

https://github.com/balysv/material-ripple

这篇关于?attr/selectableItemBackground效果仅在长按时显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆