How to add padding around a WebView

后端 未结 7 1576

My layout file defines a WebView, underneath which there are some fixed height buttons.




        
7条回答
  •  [愿得一人]
    2020-12-16 09:51

    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");
        }
    });
    

提交回复
热议问题