Android:linebreak在textview中不起作用

时间:2014-12-21 12:53:19

标签: android tags textview

我有一个字符串数组:

String[] articles = getArticles();

// articles[0] = "1. With the mixtures<br />2. Colors and others<br />";
// articles[1] = "3. Categories and people<br />4. Health and fitness";

StringBuilder sb = new StringBuilder();

for (String text : articles) {
   sb.append(text);
}

String content = sb.toString();
Spanned spanned = Html.fromHtml(content);

textView.setText(spanned);

问题在于textView我正在获取HTML标记,而不是应用换行符。

1. With the mixtures<br />2. Colors and others<br />3. Categories and people<br />4. Health and fitness

1 个答案:

答案 0 :(得分:0)

articles[0] = "1. With the mixtures&lt;<br />2. Colors and others&lt;<br />";
// articles[1] = "3. Categories and people&lt;<br />4. Health and fitness";
相关问题