NightWhistler / HtmlSpanner

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

The underline does not work #31

Open MWNemesis opened 9 years ago

MWNemesis commented 9 years ago

Tag or Style text-decoration: underline does not work, there is a way to make it work?

shivakumars commented 9 years ago

I guess the library doesn't support "". I could find the TagNodeHandler declaration for "u". Does it support in any other way?

lkravchuk commented 9 years ago

You can create your own handler

public class UnderlineHandler extends TagNodeHandler {

 @Override
 public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end, SpanStack spanStack) {
    spanStack.pushSpan(new UnderlineSpan(), start, end);
 }
}

and than register it in HtmlSpanner class:

 registerHandler("u", new UnderlineHandler());