How to display HTML table with rows and columns in WebView in Android.
Give me some example.
Create an HTML
template
String myTable = "<table border=1>" +
"<tr>" +
"<td>row 1, cell 1</td>" +
"<td>row 1, cell 2</td>" +
"</tr>" +
"<tr>" +
"<td>row 2, cell 1</td>" +
"<td>row 2, cell 2</td>" +
"</tr>" +
"</table>";
and load into your WebView
myWebView.loadDataWithBaseURL(null, myTable, "text/html", "utf-8", null);
Its also working for me:
String tag = "<table border=1>" +
"<tr>" +
"<td>row 1, cell 1</td>" +
"<td>row 1, cell 2</td>" +
"</tr>" +
"<tr>" +
"<td>row 2, cell 1</td>" +
"<td>row 2, cell 2</td>" +
"</tr>" +
"</table>";
((WebView) findViewById(R.id.web)).loadData(tag, "text/html", "utf-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With