I get the Html String from the server.
I applied this serverString to TextView
using HtmlCompat
.
The inside of the body tag works correctly, but the inside of the style tag does not work, and the code is exposed to TextView as it is.
val serverString = """
<html>
<head>
<style>
body {
font-family: 'Noto Sans KR', sans-serif;
font-size: 14pt;
color: #333;
}
p {
margin-bottom: 16px;
}
.underline {
text-decoration: underline;
}
.red {
color: #FF0000;
}
</style>
</head>
<body>
<p>This is a sample text with <b>bold</b>, <i>italic</i>, and <span class="underline">underline</span> text.</p>
<p>This is another paragraph with <span class="red">red</span> text.</p>
<p>This is a long paragraph with line breaks:<br/>
First line<br/>
Second line<br/>
Third line
</p>
</body>
</html>
binding.textView.text = HtmlCompat.fromHtml(serverString, HtmlCompat.FROM_HTML_MODE_LEGACY)
Below is the result image.
How can I get the code to be applied correctly applied?