【问题标题】:How can i display .docx and .pdf file in webview?如何在 webview 中显示 .docx 和 .pdf 文件?
【发布时间】:2014-04-03 14:08:17
【问题描述】:

如何在不使用 url 的 WebView 中显示 docx 和 pdf 文件?

在android中读取文档文件有什么想法吗?

【问题讨论】:

  • 你的问题得到答案了吗?

标签: android android-webview document docx


【解决方案1】:

试试这个,

WebView webview = new WebView(this);
setContentView(webview);
String myPdfUrl = "http://example.com/awesome.pdf";
String url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
Log.i(TAG, "Opening PDF: " + url);
webview.getSettings().setPluginsEnabled(true);
webView.getSettings().setJavaScriptEnabled(true); 
webView.loadUrl(url);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-23
    • 1970-01-01
    • 2013-05-09
    • 1970-01-01
    • 2017-11-26
    • 1970-01-01
    • 1970-01-01
    • 2018-01-31
    相关资源
    最近更新 更多