Is there possibility in android to provide TextView some text in Java code with setText(text) function with basic tags like and to make marked words underlined ?
You can also underline a portion of the text via code, it can be done by creating a SpannableString and then setting it as the TextView text property: SpannableString text = new SpannableString("Voglio sottolineare solo questa parola");text. setSpan(new UnderlineSpan(), 25, 6, 0);textView. setText(text);
If you just want to add a line break in the form: textView. setText(string1+System. getProperty ("line. separator")+string2); then it works a treat, thank you!
The quickest way to underline text is to press Ctrl+U and start typing. When you want to stop underlining, press Ctrl+U again. You can also underline text and spaces in several other ways.
Yes, you can, use the Html.fromhtml() method:
textView.setText(Html.fromHtml("this is <u>underlined</u> text"));
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