android - Jetpack Compose 中的未绑定波纹/指示(相当于 selectableBackgroundBorderless)
问题描述
在 Jetpack Compose 中,clickable
修改器将默认使用LocalIndication.current
并显示绑定到边框的波纹。这看起来几乎总是很棒,但在某些情况下,圆形的、未绑定的波纹看起来更好。回到 View Android 中,我们会用它android:background="?attr/selectableItemBackgroundBorderless
来实现这种行为。我们如何在compose中做到这一点?
示例[来源]:
解决方案
您可以按如下方式自定义波纹效果:
Modifier.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false), // You can also change the color and radius of the ripple
onClick = {}
)
推荐阅读
- php - 不考虑 PHP 顺序的字符串比较
- kubernetes - Spinnaker - 在清单中引用 ConfigMap 版本化值
- angular - 如何在 Angular 7 中使用 css 预处理器
- abap - CHANGEDOCUMENT_READ_HEADERS 为什么我无法读取条目的创建者?
- kubernetes - 如果 POD 有唯一的 IP 地址,POD 中每个容器的 IP 地址是什么?
- cucumber-junit - 步骤在黄瓜特征文件中没有匹配的胶水代码
- javascript - 如何通过 Ajax 请求正确使用和呈现云功能服务器数据?
- c# - 如何从列表中删除当前正在播放的索引项,但变量“i”现在是 1 而不是 0?
- twitter-bootstrap - 表响应仅在需要时显示滚动条
- typescript - TS:如何获取常量数组元素类型