I saw a an answer on how to implement the new tooltipBox (Android Compose - Alternative to PlainTooltipBox (deprecated))
But now it only works after a LongPress on my Icon, how can I change this. is it possible to show after one click and dismiss after clicking again or somewhere else ?
So far this is my Code:
TooltipBox(
positionProvider = TooltipDefaults.rememberRichTooltipPositionProvider(),
tooltip = { RichTooltip(title = { Text("Smart Cycle") }, text = { Text("If enabled, the cycle will automatically be detected, starting with the highest paycheck") })},
state = rememberTooltipState()) {
IconButton(onClick = { }) {
Icon(Icons.Default.Info, contentDescription = "info")
}
}
I thought maybe its possible to change that in the state
You can manually show the tooltip by calling TooltipState::show
as you can see in RichTooltipWithManualInvocationSample
:
val tooltipState = rememberTooltipState()
val scope = rememberCoroutineScope()
TooltipBox(
state = tooltipState,
...
) {
IconButton(
onClick = { scope.launch { tooltipState.show() } }
) { ... }
}