Creating a Strikethrough Text

Is there an easy way to strike through text in an app widget?

You can use this:

remoteviews.setInt(R.id.YourTextView, "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

Of course you can also add other flags from the android.graphics.Paint class.

How to strikethrough Text in android Jetpack Compose?

Add style for text

@Composable
fun TextWithLineThroughExample(){
Text(
text = "Text with LineThrough",
style = TextStyle(textDecoration = TextDecoration.LineThrough)
)
}

Sample Image



Related Topics



Leave a reply



Submit