How to add padding around a WebView
The WebView has a bug in the padding implementation. Setting a padding on a webview won't pad the actual web page, but WILL pad the scrollbars. It's only partially working as expected. Your solution is the best way to achieve 'padding' for a WebView.
Another workaround for this problem could be in javascript usage. So when your webpage is loaded you can do such js call to set paddings:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
webView.loadUrl("javascript:document.body.style.margin=\"8%\"; void 0");
}
});