[英]How to strikethrough Text in android Jetpack Compose?
I want to strikethrough a Text
in Android Jetpack Compose.我想删除 Android Jetpack Compose 中的Text
。 I have checked some documentation but I still don't find something that looks to what I want to achieve.我已经检查了一些文档,但我仍然没有找到符合我想要实现的目标。
https://developer.android.com/jetpack/compose/text https://developer.android.com/jetpack/compose/text
This is my Text component:这是我的文本组件:
Text("$863",fontSize = 24.sp, modifier = Modifier.width(IntrinsicSize.Min), maxLines = 1)
This is what I want to achieve:这就是我想要实现的目标:
Can any one please help me or give me any idea?任何人都可以帮助我或给我任何想法吗?
I recommend copying the current style with adjusted properties:我建议使用调整后的属性复制当前样式:
@Composable
fun textWithLineThroughExample(){
Text(
text = "Text with LineThrough",
style = LocalTextStyle.current.copy(textDecoration = TextDecoration.LineThrough)
)
}
This approach keeps all other existing style properties (for example within a ProvideTextStyle
block).此方法保留所有其他现有样式属性(例如在ProvideTextStyle
块中)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.