2
按照许多建议,我试图使用goolge文档在WebView中显示PDF。Google文档PDF查看器
这里是我的代码:
@SuppressLint("SetJavaScriptEnabled")
public void setDocumentPath(final String path) {
WebView webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginsEnabled(true);
webView.loadUrl("https://docs.google.com/viewer?url=http://www.selab.isti.cnr.it/ws-mate/example.pdf");
}
PDF格式的只是一些例子,我在网上找到。它在我的浏览器中工作,但在我的android模拟器和设备上显示“网页不可用”。
两者都运行Android 4.0。
有什么明显的我失踪了吗?谢谢。