Cesar Bellic
Cesar Bellic

Reputation: 61

Android Line Break on htmlText

enter image description here

I'm trying to create an item description in a form of a list.

Example:

  1. Medium
  2. 100% Cotton
  3. Etc

This description is sotred in my database, text as a data type.

The problem :

Im gettin all description in one line, I´ve tried to insert line breaks by replacing "." for "\n" and using HTML tags but doesnt seem to work.

        htmlText = post.cloths_description;


    String text = "<html><head>"
            + "<style>img{max-width:100%;height:auto;} figure{max-width:100%;height:auto;} iframe{width:100%;}</style> "
            + "<style type=\"text/css\">body{color: #000000;}"
            + "</style></head>"
            + "<body>"
            + htmlText
            + "</body></html>";

Result : 1. Medium 2. 100% Cotton 3. Etc

Any ideas on what else could I do ?

Best Regards

Upvotes: 0

Views: 219

Answers (1)

Jian Astrero
Jian Astrero

Reputation: 742

Use line breaks.

<br />

This is elementary HTML.

Update: Try this:

Html.fromHtml(htmlText);

Upvotes: 1

Related Questions