NightWhistler / HtmlSpanner

Android HTML rendering library with CSS support
http://nightwhistler.github.io/HtmlSpanner/
868 stars 209 forks source link

inline style not working #45

Closed kuldeep8486 closed 8 years ago

kuldeep8486 commented 8 years ago

I want to give inline styling using HtmlSpanner. <span style="background-color: #FFFF00">Yellow text.</span>

How may I achieve this using this library.

kuldeep8486 commented 8 years ago

I have found a workaround. I have registered "span" tag inside "registerBuiltInHandlers" method of "HtmlSpanner" class. Style spanStyle = new Style().setDisplayStyle(Style.DisplayStyle.INLINE); TagNodeHandler spanHandler = new BorderAttributeHandler(wrap(new StyledTextHandler(spanStyle))); registerHandler("span", spanHandler);

This will allow span tag in html preview as inline block.