htmlText上的Android Line Break

问题描述 投票:0回答:1

enter image description here

我正在尝试以列表的形式创建项目描述。

例:

  1. 介质
  2. 100%纯棉
  3. 等等

此描述存储在我的数据库中,文本存储为数据类型。

问题 :

我在一行中获得所有描述,我试图通过替换“。”来插入换行符。对于“\ n”和使用HTML标记,但似乎没有用。

        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>";

结果:1。中等2. 100%棉3.等

关于我还能做什么的任何想法?

最好的祝福

android html mysql
1个回答
1
投票

使用换行符。

<br />

This is elementary HTML.

更新:试试这个:

Html.fromHtml(htmlText);
© www.soinside.com 2019 - 2024. All rights reserved.