I have an problem setting textcolor on some part of a Textview.
The text is defined to have the color white in the layout-xml.
When the user chooses the write answer in the game this method call is triggered:
this.Question = (TextView) findViewById(R.id.layout1Question);
this.Question.setText(Html.fromHtml("<font color = 'green'>CORRECT: </font>") + this.CurrentQuestion.getFillin());
Here I want the CORRECT -part to show green text while the rest should be white as default.
But the whole text is shown in white. What am I doing wrong?
Thanks for any help!
EDIT: It works if I remove the second part, hence:
this.Question.setText(Html.fromHtml("<font color = 'green'>CORRECT: </font>"));
works okay.
Try moving the
geFillin()call tofromHtmlparameter. May be the string concatenation is casting theSpannedstring back to simple string.