简体   繁体   中英

Use Html.fromHtml with android 8 hex digit color resource

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!

尝试这个:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM