【发布时间】:2021-07-11 06:26:23
【问题描述】:
使用 jetpack compose,对于 clickevent 如何执行触觉反馈。我是jetpack compose的新手。 这是我尝试过的-
val hapticFeedback = LocalHapticFeedback
@Composable
fun Tab() {
Row() {
Icon(imageVector = icon, contentDescription = text)
if (selected) {
// i tried both the following ways, none are working.
hapticFeedback.current.performHapticFeedback(
HapticFeedbackType(10)
)
hapticFeedback.current.performHapticFeedback(HapticFeedbackType.TextHandleMove)
....
Spacer(Modifier.width(12.dp))
Text(text.uppercase(Locale.getDefault()))
}
}
}
我可以在文本被选中时看到它,但没有得到细微的振动反馈。
【问题讨论】:
标签: android-jetpack-compose haptic-feedback