我在这个字符串中有html字符串和SpannableString,我把它们都放在TextView中,问题出在SpannableString中,它没有显示在Html.fromhtml()中。如何在Html.fromHtml()中显示SpannableString?有可能吗?
for(int index = 0; index < l.length; index++){ // have3d() return SpannableString
x += "<font color=\"green\">" + have3d(title[index]) + " </font> <br />" + l[index] + "<br/><br/>";
if(index == l.length-1){
x += "<font color=\"green\">" + title[index] + " </font> <br />" + l[index] + "<br/>";
}
}
mСinema.setText(Html.fromHtml(x));发布于 2013-10-17 22:14:05
Html.fromHtml返回一个Spanned,您可以通过以下方式将其转换为SpannableString:
SpannableString text = new SpannableString(Html.fromHtml(x));然后调用以下命令来设置它:
mcinema.setText(text, BufferType.SPANNABLE);https://stackoverflow.com/questions/14874303
复制相似问题