user3860990
user3860990

Reputation: 49

How to format text in string displayed in TextView

I'm trying to format text in string, which is displyed in TextView.

<string name="register"> <p align="center"><u><b><i>Something</i></b></u></p> 
                         <p align="right">Blablabla</p>

Underline, bolt and italics are working, but new paragraph and align isn't. Am I doing something wrong? Is there some other tag for end of a paragraph/new line?

Upvotes: 4

Views: 12825

Answers (2)

George Thomas
George Thomas

Reputation: 4586

You can use

myTextView.setText(Html.fromHtml("<h2>Heading</h2><br><p>data about something</p>"));

Upvotes: 4

ngrashia
ngrashia

Reputation: 9884

Refer here http://bigknol.com/android-supported-html-tags-textview-string/

Not all html tags are supported in android. As per the link only the following tags are supported:

<big></big>
<small></small>
<bold></bold>
<strike></strike>
<a href=””></a>
<sup></sup>
<sub></sub>
<u></u>
<i></i>
<tt></tt>

Also refer here Which HTML tags are supported by Android TextView? Another reference is here http://javatechig.com/android/display-html-in-android-textview

Upvotes: 4

Related Questions