【发布时间】:2021-07-29 23:56:11
【问题描述】:
当某个布尔变量为真时,我的一个 Composables 中的文本会被删除。如何在重新合成时为TextStyle 中的这种变化设置动画,以便线条淡入而不是突然出现和消失?
@Composable
fun MyComposable(
completed: Boolean
) {
val textStyle = TextStyle(textDecoration = if (completed) TextDecoration.LineThrough else null)
Text(
text = title,
color = textColor,
style = textStyle,
modifier = Modifier.align(Alignment.CenterVertically)
)
【问题讨论】:
-
你想怎么做动画?
-
@GabrieleMariotti 谢谢你指出这一点,我在我的问题中澄清了!
标签: android android-jetpack-compose android-jetpack-compose-text