I want to strikethrough a Text
in Android Jetpack Compose. 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
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?
Add style for text
@Composable
fun TextWithLineThroughExample(){
Text(
text = "Text with LineThrough",
style = TextStyle(textDecoration = TextDecoration.LineThrough)
)
}
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With