tags:

views:

33

answers:

1

Is alignment working in HTML.fromHtml() in a TextView?

I tried

<div align="center"><p>Test</p></div>

and some variaties of this, including putting the alignment tabs without parenthesis to the paragraph tag, but none worked. The text is always left.

Thanks for any help!

Yours.

+1  A: 

Alignment is not supported in HTML text in TextView.

Romain Guy
What a nice site this is with all these helpful people and quick answers! However, the follow-up is obvious: What HTML is supported?
Rene
THe supported tags are: p, div, em, b, strong, cite, dfn, i, big, small, font, blockquote, tt, a, u, sup, sub, h1 to h6 and img. Note that you can also provide your own TagHandler by calling fromHtml(String, ImageGetter, TagHandler). This lets you add support for any tag you want.
Romain Guy
Thanks for this. I would like a centered alignment. This seems to be impossible in the text view at all, so a handler would not help.
Rene
What is the div for?
Rene
You can set the text alignment using android:gravity="center_horizontal"
Romain Guy