[英]Unbound Ripple/Indication in Jetpack Compose (equivalent to selectableBackgroundBorderless)
在 Jetpack Compose 中, clickable
的修飾符將默認使用LocalIndication.current
並顯示綁定到邊框的波紋。 這看起來幾乎總是很棒,但在某些情況下,圓形的、未綁定的波紋看起來更好。 返回視圖 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 = {}
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.