I am using android webview in my application. I noticed that it has a built-in margin.So you need to remove it in accordance with the requirements of the user interface.
I used this to get the perfect result.
@Override
public void onPageFinished(WebView view, String url) {
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("javascript:document.body.style.margin=\"0%\"; void 0");
webView.setVisibility(View.VISIBLE);
}
it becomes updated when it is notified, and looks too bad. But can we also apply JavaScript to our html code? I used <script> <script/>there, but there was no result.
webView.loadDataWithBaseURL(null, "<style>a{color:#3D7B8A; text-decoration:none}</style>"+ getDescription().replace("<p>", "<p style= \"line-height: 150%; text-align: justify;\" >"), "text/html", "utf-8",
null);
Please inform.
source
share