![how to strikethrough text android facebook how to strikethrough text android facebook](https://capitalizemytitle.com/wp-content/uploads/2020/01/step-2-post-bold-text-to-Facebook-300x220.png)
Java users, use this ‘~’ symbol with Paint.STRIKE_THRU_TEXT_FLAG. Use inv() method with Paint.STRIKE_THRU_TEXT_FLAG. So let’s create a horizontal line using view and position it above-center of the TextView. RelativeLayout positions its element relative to each other. Using RelativeLayout and View – Android TextView Strikethrough XML example Put strikethrough_layerlist.xml as TextView’s background value. Just like the above example, put this also as TextView’s background value. We can create a horizontal line using layerlist drawable also. Using LayerList – Android TextView StrikeThrough XML Put strikethrough_shape.xml as TextView background attribute value. Using Shape drawable, create a horizontal line and put that line middle of your text. Using shape drawable – Android TextView StrikeThrough XML tSpan(new StrikethroughSpan(),4,17, 0) Ĥ. here strikethrough start point: 4, end point: 17 SpannableString spannableString32=new SpannableString("3.2 StrikeThrough Using SpannableString") Textview2.paintFlags = textview2.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG It creates strikethrough for TextView easily. Paint class provides STRIKE_THRU_TEXT_FLAG Using Paint Flags – TextView StrikeThrough Example Create a string element in strings.xml and place text which you want to get strikethrough between opening tag and closing tag. Like Html, tag easily creates a horizontal line through our TextView content. Using Strike – Android TextView StrikeThrough XML example
#HOW TO STRIKETHROUGH TEXT ANDROID FACEBOOK HOW TO#
![how to strikethrough text android facebook how to strikethrough text android facebook](https://www.lifewire.com/thmb/KapSgatqEiATEQtIxhvEwbe6NKo=/960x720/smart/filters:no_upscale()/A3-UseBoldItalicsandStrikethroughinWhatsAppMessages-annotated-0abc55958a0945fd9441991b9738d781.jpg)
Here, I have discussed 4 Android TextView StrikeThrough XML and 2 Java/Kotlin examples. So If you are making an e-commerce app it’s better to know how to strikethrough a text. It makes us think we get more discount, so it increases the chances to buy the product. Strikethrough used to show the old price or real price with the selling price. You might have seen strikethrough text in websites or apps. Share on Facebook Share on Twitter Pinterest Email