Reputation: 47
I know this question is asked number of times but still here I am asking it again. I have json data being fetched in my app. This data is in html format. The other data is being displayed fine in textview the problem occurs when there is a table along with data. All I want is the table to get displayed in proper format.
I have been though various examples and questions like this,this,the answer here, also this. These are few links I have been to. I am trying to find answer for this for past few days but every answer mostly suggests using webview or is not getting the desired result.
I can't use webview so isn't there a solution to atleast format table in proper way?
If anyone can help me I will really be thankful. Thank you.
Edit: this is what I expect enter image description here
Also I can't include webview because webview doesnot fulfil all requirements of my app and textview is displaying everything fine except tables.
Upvotes: 3
Views: 2636
Reputation: 786
Here is an library in Github which supports html tables - https://github.com/PrivacyApps/html-textview
Supported tags:
<p>
<div> handled exactly like <p>
<br>
<b>
<i>
<strong>
<em>
<u>
<tt>
<dfn>
<sub>
<sup>
<blockquote>
<cite>
<big>
<small>
<font size="..." color="..." face="...">
<h1>, <h2>, <h3>, <h4>, <h5>, <h6>
<a href="...">
<img src="...">
Also: Extended support by HtmlTextView
<ul>
<ol>
<li>
<code>
<center>
<strike>
Support for HTML tables
HtmlTextView now supports HTML tables (to a limited extent) by condensing the text into a link which developers are able to render in a native WebView. To take advantage of the feature you'll need to:
We recognize the standard table tags:
<table>
<tr>
<th>
<td>
Upvotes: 2