简体   繁体   English

带有Html.fromhtml的div标签

[英]div tag with Html.fromhtml

I have read from various blogs that div tag is supported by Html.fromHtml but it doesn't support style attribute. 我从各种博客中了解到Html.fromHtml支持div标签,但它不支持style属性。

What i want to do is to assign a background color as specified by the string which contains the html tags. 我想做的是分配一个包含html标签的字符串指定的背景色。 Something like 就像是

    <p style="background-color:green;">This is a paragraph.</p>

If style attribute is not supported by Html.fromHtml(), is there any other way such that I can change the bgcolor using html tags. 如果Html.fromHtml()不支持style属性,是否还有其他方法可以更改html标签的bgcolor。

Thanks. 谢谢。

使用代码:

 yourfield.setBackgroundColor(Color.parseColor("#ca1216"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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