I try to display an HTML text with its styles, but the text is shown without styling.
- Is this normal behavior? It possible?
- Is there a nice way to extract the styling from the HTML and apply it to my view?
In my code there are two numbers, one should be red and the other should be striped. In action, they both seems as simple text.
Here is my code:
String str = "<span>  <span dir=\"rtl\" style=\"text-align:right;color:#ff0000;\"> 20.00</span> <span dir=\"rtl\" style=\"text-align:right;text-decoration: line-through;\">26.99 </span></span>";
Spanned spanned = Html.fromHtml(str);
txtView.setText(spanned);
not all the html tags are supported (take a look here)
In my experience I have seen worked only div and p…