admin管理员组文章数量:1333664
I have a textview in an Android application. I want to set the textview's value from HTML. For example, I get a value like this:
<span style="font-family:'Roboto-Regular'; font-size:13px; color:#383838 \">102,</span>
<span style="font-family:'Roboto-Regular'; font-size:11px; color:#383838 \">60 TL</span>
and I want to set the textview's value using the fromhtml()
method. The color
tag is working perfectly, but the font-size
tag is not working - I expect the text after the comma to be small, but the tag doesn't change the text size at all.
I have a textview in an Android application. I want to set the textview's value from HTML. For example, I get a value like this:
<span style="font-family:'Roboto-Regular'; font-size:13px; color:#383838 \">102,</span>
<span style="font-family:'Roboto-Regular'; font-size:11px; color:#383838 \">60 TL</span>
and I want to set the textview's value using the fromhtml()
method. The color
tag is working perfectly, but the font-size
tag is not working - I expect the text after the comma to be small, but the tag doesn't change the text size at all.
1 Answer
Reset to default 0Html.fromHtml()
does not handle arbitrary HTML, let alone arbitrary CSS. While it does support color
in a style
attribute (at least on modern versions of Android), it does not support font-size
or font-family
. You will need to handle those yourself by other means.
本文标签: androidfont size is not working when using from htmlStack Overflow
版权声明:本文标题:android - font size is not working when using from html - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742344586a2457268.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论