0

So, say I have some colors defined in my R.java file such as "public static int red=0x7f06000c;"

How do I apply the color in the html code?

I tried

Html.fromHtml("<font color= '" + R.color.red + "'> some text  </font>)

but the color returned is black...

Thanks for answering my question!

1 Answer 1

1

Try this:

Html.fromHtml("<font color=" + getResources().getColor(R.color.red) + "> some text  </font>");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.