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。
有什麼明顯的我失蹤了嗎?謝謝。