[英]Jetpack compose “Text” function deprecated (1.0.0-alpha09)
(config: compose_version = '1.0.0-alpha09' kotlin_version = "1.4.21") (配置:compose_version = '1.0.0-alpha09' kotlin_version = "1.4.21")
The Jetpack Composable function "Text" is deprecated Jetpack 可组合 function“文本”已弃用
Text( // <===== Strikethrough in Android Studio
text = "Anna"
)
but I can't figure out how to replace it.但我不知道如何更换它。 The doc says to replace by... Text文档说要替换为... 文本
@Deprecated(
message = "Use androidx.compose.material.Text for a high level Text component that " +
"consumes theming information, or androidx.compose.foundation.text.BasicText for a basic " +
"unopinionated component that does not have default theming",
replaceWith = ReplaceWith(
"Text(text, modifier, color, fontSize, fontStyle, fontWeight, fontFamily, " +
"letterSpacing, textDecoration, textAlign, lineHeight, overflow, softWrap, maxLines, " +
"onTextLayout, style)",
"androidx.compose.material.Text"
)
)
Change your androidx.compose.foundation.Text
import to将您的androidx.compose.foundation.Text
导入更改为
import androidx.compose.material.Text
to use the non-deprecated Material version of Text
, which is the drop in replacement for what Text
did in previous alphas.使用Text
的非弃用 Material 版本,这是替代Text
在以前的 alpha 中所做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.