网站中的PDF链接未在Webview上显示内容。我当前正在使用Googledocs。
这是我的Java代码
demoscad.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
demoscad.getSettings().setDomStorageEnabled(true);
demoscad.getSettings().setLoadWithOverviewMode(true);
demoscad.getSettings().setAllowFileAccess(true);
demoscad.getSettings().setUseWideViewPort(true);
demoscad.getSettings().setBuiltInZoomControls(true);
demoscad.getSettings().setJavaScriptEnabled(true);
demoscad.getSettings().setDatabaseEnabled(true);
demoscad.getSettings().getAllowContentAccess();
demoscad.getSettings().getAllowUniversalAccessFromFileURLs();
demoscad.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if (progress >= 100) {
}
}
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error){
//Your code to do
Toast.makeText(DemosCAD.this, "This is my Toast message!",
Toast.LENGTH_LONG).show();
}
});
String demos = "https:xxxxx + userId;
String googledocs = "http://docs.google.com/gview?embedded=true&url=";
demoscad.loadUrl(demos + googledocs);
demoscad.setWebViewClient(new WebViewClient());
demoscad.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
答案 0 :(得分:0)
首先添加googledocs网址,然后添加自定义网址,使其应像这样
demoscad.loadUrl(googledocs+demos);
像这样
String demos = "https://xxx" + userId;
String googledocs = "http://docs.google.com/gview?embedded=true&url=";
demoscad.loadUrl(googledocs+demos);
demoscad.setWebViewClient(new WebViewClient());
demoscad.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);