user2020680
user2020680

Reputation: 131

Webview is not displaying table properly in 4.0+ in android

I am using the following code to display content in webview.

    mMessageContentView.setText(emailText, contentType);
    mMessageContentView.scrollTo(0, 0);
    mMessageContentView.getSettings().setUseWideViewPort(true);
    mMessageContentView.getSettings().setJavaScriptEnabled(true);

It is displaying properly in nexus one,samsung player etc,but it is not displaying in Samsung s2(4.0.1),Samsung Nexus(4.2.1)

Here i am attaching the Screen shots of both(Nexus one,Google nexus)Google Nexus).enter image description here

Upvotes: 3

Views: 2153

Answers (2)

user2020680
user2020680

Reputation: 131

I observed that , In some devices like Samsung Galaxy S2,S3 etc Webview displays the Table in a single column. So i applied the following code to chage the Webview Table setting as Normal.

    mMessageContentView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

Then it is displaying in Correct format in all the devices.

Upvotes: 5

Kristian
Kristian

Reputation: 354

Do you have the raw HTML from the table? It is impossible to know what is right and wrong without that.

You can also check how it renders in a recent version of Chrome or Safari.

Upvotes: 1

Related Questions