Search code examples
androidtextviewtextcolor

Change text view text color based on parsed xml value


I'm trying to make a text view change its text colour depending on what the value is in an XML file.

I've managed to get an XML parser which I vaguely know what it is doing, and I'm writing the elements value to the log.

Is this even possible or will I have to store the results from the XML parse first before I can use them to change the text views text colour?


Solution

  • It's fully possible :)

    yourTextView.setTextColor(Color.parseColor("#FFFFFF"));
    

    where "#FFFFFF" of course is the color value string from your XML.