Line Break in XML formatting? Line Break in XML formatting? xml xml

Line Break in XML formatting?


Use \n for a line break and \t if you want to insert a tab.

You can also use some XML tags for basic formatting: <b> for bold text, <i> for italics, and <u> for underlined text.

Other formatting options are shown in this article on the Android Developers' site:
https://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling


If you are refering to res strings, use CDATA with \n.

<string name="about">    <![CDATA[ Author: Sergio Abreu\n http://sites.sitesbr.net  ]]>        </string>


Also you can add <br> instead of \n.

And then you can add text to TexView:

articleTextView.setText(Html.fromHtml(textForTextView));