How to display html with css stylesheet in TextView?


Tags: android,html,css,spannable

Problem :

Converting html file to spanned object and displaying it in TextView works fine but what if I want to also apply css styles? I've tried to combine css styles with html file but styles ale ignored by Html.fromHtml() method.

How can I display text modified by css styles in my TextView?



Solution :

what if I want to also apply css styles?

That is not supported by Html.fromHtml(). You will need to build your own HTML/CSS parser and build your own formatted string, perhaps using SpannableStringBuilder.


    CSS Howto..

    Is there a limit to how deep an HTML document or CSS tree can be?

    How to force elements to be in middle?

    How to add a css on a div by finding a children class on its sibling div by jquery

    How to have images in line with text in css

    How to make a dynamic-height DIV [duplicate]

    How to make a search bar clippable without pushing down elements, using 2 inputs

    Using Bootstrap, how do i achieve this horizontal tab layout? [closed]

    How to add an unknown amount of dots to a line depending on length of word?

    How to apply jquery ui styling on dynamically generated elements

    How to position a CSS sprite background image within the element?

    How to change where a CSS transition starts from?

    How to apply CSS on texte label beside an input?

    how to set the css left property of a class on the basis of an ID of a tag

    How to make CSS animation jump rather than slide

    How to style a button's font in CSS?

    How to remove spacing between tags?

    How to center a div horizontally in a table using CSS

    how to create a css attribute swapper between two elements?

    css/html how to make logo appear after heading

    Using CSS to show/hide content. How do I make hide the default

    How to fix width of tooltip at IE8

    Html and CSS for emails, how to, where to?

    How to grab a CSS syntax with JavaScript?

    how can I align text/image/links within a grid
    of the twitter bootstrap css?

    How semantic X/HTML can save time when we will write CSS?

    How to force CSS to be displayed on empty element following whitespace

    How to properly add divs inside another div so the original design doesn't break?

    CSS3 Menu Shows Up Wrong (CSS3/HTML5)

    How can I prevent overflow from a fieldset?

    How to reverse a CSS3 hover transformation?