Code:
private void initTextView(){
String html = "<html><body><span style="color:green">In the name of <span style="color:blue"><b> God</b></span>the compassionate, the merciful</span></body><html>";
TextView htmlTextView = findViewById(R.id.html_text);
htmlTextView.setText(HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_LEGACY));
}
The UI behaves differently than the browser, while browser’ behaviour is what I expect. The color of word God
should be the blue, but it is green!
I found a similar problem(Android Html.fromHtml() does not work correctly on nested text style) 11 years ago, but it has been not solved yet.