Chan Yoong Hon
Chan Yoong Hon

Reputation: 1812

Android : htm.fromhtm() remove blank line from under H1, H2,H3,H4,H5,H6 tag

I am displaying of my HTML code in my textview and using html.fromhtml(). However, when comes to display h1 tag. It must have empty line after h1. I try to fix it by adding . But I understand that html.fromhtml() does not support class. May I know is it any solution to remove empty line after h1 in html.fromhtml()? The following is my sample code

 title="<h1>Human Resource</h1>";
 textView.setText(Html.fromHtml(title));

Upvotes: 1

Views: 526

Answers (1)

Aldasa
Aldasa

Reputation: 4681

There will always be a blank space after < h1 > tags. Just like using < p > tags.

You could replace < h1 > tag programically:

title="<h1>Human Resource</h1>";
title = title.replace("<h1>", "<b>");
title = title.replace("</h1>", </b></br>");
textView.setText(Html.fromHtml(title));

Upvotes: 1

Related Questions