Supported HTML tag for Android TextView

Android TextView show the text but you can format this text by using HTML tag. Sometime it's necessary to use HTML tag in TextView. Android TextView support some HTML tag. To get you know, here I provide the lists of supported HTML tag for Android TextView.

Useful HTML tag for Android TextView: 

You can use this tag inside TextView or other android widget like Button as a text. Before starting your works, you have to look over the supported HTML tag for TextView. Check this list below:

<a href="...">
<b>
<big>
<blockquote>
<br>
<cite>
<dfn>
<div align="...">
<em>
<font size="..." color="..." face="...">
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<i>
<img src="...">
<p>
<small>
<strike>
<strong>
<sub>
<sup>
<tt>
<u>
Now the question is how I can use this tag inside TextView. If you want to use these tag, at first you need to call Html.fromHtml() method. Here is an example for you. 
		TextView tv = (TextView) findViewById(R.id.tv_text);
tvHeader.setText(Html.fromHtml("<b>I love you</b>"));

You can use other supported tag inside Html.fromHtml() method. 

Comments

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Conflict Serializability in database