2

I have read from various blogs that div tag is supported by Html.fromHtml but it doesn't support style attribute.

What i want to do is to assign a background color as specified by the string which contains the html tags. 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.

Thanks.

Deepak Senapati
  • 1,103
  • 2
  • 11
  • 30
  • Dont just post a whole story... post code and things that you have tried ..that way its helpful for everyone. Thanks – Shail Mar 01 '13 at 11:11
  • Thanks..I made some changes regarding that. – Deepak Senapati Mar 01 '13 at 11:40
  • you should use Html.TagHandler [http://stackoverflow.com/questions/4044509/android-how-to-use-the-html-taghandler][1] [1]: http://stackoverflow.com/questions/4044509/android-how-to-use-the-html-taghandler – Mojtaba Haddadi May 20 '13 at 07:21

1 Answers1

0

use the code:

 yourfield.setBackgroundColor(Color.parseColor("#ca1216"));
Danny
  • 1,050
  • 3
  • 11
  • 26