views:

21

answers:

1

hi, How to html table with rows and columns in webview in Android. Can I have one sample Example

Thank you

A: 

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);
Jorgesys
It works fine, but the problem is I am unable to use other features of HTML table like I want to reduce the cellspacing between rows, or I want to add some color to cell spacing called Border Color, which I am not able to do with Android. Can u give me sample code for table which appears exactly like table with lines in middle of columns and rows.Thanks in Advance,
Android_prog