你好朋友我在单个文本视图中设置了两种不同的颜色,如下所示
我的代码如下
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();
}
是我设置的textview
mStringQustion = Utility.getAnswers(currentGame.getQuestions());
并获得如下输出
我该如何解决?