javascript - I want to display the contents of html file (with formatting) on TextView in android -


this html file want display on textview :

<html> <head>     <link rel="stylesheet" href="highlight/styles/default.css">     <script src="highlight/highlight.pack.js"></script>     <script>hljs.inithighlightingonload();</script> </head> <body>  <h1>c program calculate area of circle</h1> <p class="test"><pre><code class="c">#include&lt;stdio.h&gt;  int main() {    area = 3.14 * radius * radius;    printf("\narea of circle : %f", area); } </code></pre></p> <br> <!--output--> <div><br>enter radius of circle : 2.0<br> area of circle : 6.14<br>&nbsp;</div> </body> </html>  

it has external linking .js , .css files

i've stored in assets folder.

htmlcontentinstringformat=""; string htmlfilename = "www/"+filename; assetmanager mgr = getbasecontext().getassets(); inputstream in = mgr.open(htmlfilename, assetmanager.access_buffer); htmlcontentinstringformat = streamtostring(in); in.close(); 

i'm using mtextview.settext(html.fromhtml(htmlcontentinstringformat)), displaying plain text. want proper stylized text, displayed when open .html file :

desired output

please me.

html.fromhtml() let view light weight html in textview:

mytextview.settext(html.fromhtml(htmlcontentinstringformat)); 

if want js , css work it, need use webview. load html file assets webview may refer answer here.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -