Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以,假设我在我的 R.java 文件中定义了一些颜色,例如“public static int red=0x7f06000c;”
如何在 html 代码中应用颜色?
我试过
Html.fromHtml("<font color= '" + R.color.red + "'> some text </font>)
但返回的颜色是黑色...
谢谢回答我的问题!
试试这个:
Html.fromHtml("<font color=" + getResources().getColor(R.color.red) + "> some text </font>");