nilTheDev
09/30/2021, 12:26 PMonLongClick
event handler to a button? There is no parameter in the constructor. I tried with Modifier.combinedClickable
with a onLongClick
event listener. But it isn't working.
Column(modifier = Modifier.padding(30.dp)) {
Button(
onClick = {
Toast.makeText(
applicationContext,
"hi",
Toast.LENGTH_SHORT
).show()
},
modifier = Modifier.combinedClickable(
onLongClick = {
Toast.makeText(
applicationContext,
"hello",
Toast.LENGTH_SHORT
).show()
},
onClick = {}
)
) {
Text(text = "Click Me")
}
}
}
Csaba Kozák
09/30/2021, 12:58 PMSurface
will add its Modifier.clickable
always at the end of the chain.
modifier
.shadow(elevation, shape, clip = false)
.then(if (border != null) Modifier.border(border, shape) else Modifier)
.background(
color = backgroundColor,
shape = shape
)
.clip(shape)
.then(clickAndSemanticsModifier) // HERE!
nilTheDev
09/30/2021, 1:04 PMBox
and make it look like a button...