在 compose 中,我们有一些 animateState,例如 animateIntAsState,我们可以使用它在更改值时制作动画,但是如果我们想在 Compose 中为 String 制作动画呢???,例如: 文本(文本 =“某些值”)
最佳答案
有AnimatedContent
var text by remember { mutableStateOf ("SOME TEXT") }
AnimatedContent(text){
// You must use "it", not "text"
Text(it)
}
现在,只要 text
变量发生变化,它就会为该值设置动画。
您可以使用它提供的 spec
参数来操作动画类型。
更多信息here
关于android - 我们在 compose 中有 animateStringAsState 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72099616/