?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: