【发布时间】:2013-10-19 12:37:13
【问题描述】:
你好朋友,我在单个文本视图中设置了两种不同的颜色,如下所示
我的代码如下
public static String getAnswers(List<Question> questions) {
int question = 1;
StringBuffer sb = new StringBuffer();
for (Question q : questions){
String d= "<font color=#292929>" + sb.append("Q").append(question).append(") ").append(q.getQuestion()).append("? \n")+"</font>";
String ss="<font color=#ce4e00>"+sb.append("Answer: ").append(q.getAnswer()).append("\n\n")+"</font>";
AnswersActivity.results.setText(Html.fromHtml(d+ss),TextView.BufferType.SPANNABLE);
question ++;
}
return sb.toString();
}
并且是我设置的文本视图
mStringQustion = Utility.getAnswers(currentGame.getQuestions());
并得到如下输出
我该如何解决?
【问题讨论】:
标签: android