Issue
In my application there is a WebView and a button.
on button click I receive a HTML from a webservice with AsyncTask.
There are a situation when I receive the same HTML from the service.
The HTML:
<html>
<head>
</head>
<body style="font-family:Arial;">
<center>No data to display</center>
</body>
</html>
The strange behavior:
At every odd call (1, 3, 5, ...) the HTML above is centered, every even call the same HTML that aligned to left.
It happens only on Samsung Galaxy 2 and 3 with Android 4 and not happens on Motorola Atrix with Android 2.3.4.
I load the HTML with:
mReportChart.loadDataWithBaseURL("fake://", data.getHtml(), "text/html", "utf-8", "fake://");
The HTML each time is the same.
How can I resolve that problem?
Solution
Ben is right, the center
tag is not standard HTML5, so you can't expect it to work properly. The best solution, if you can, is getting rid of the center tag. But if that's not the case you can just "force" the center tag to be centered with css. Add the following to your stylesheet and it should be fixed:
center {
margin-left:auto;
margin-right:auto;
text-align:center;
}
Answered By - caiocpricci2
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.