【问题标题】:How could I display pdf in my application如何在我的应用程序中显示 pdf
【发布时间】:2018-08-16 12:06:48
【问题描述】:

您好,我使用以下代码在我的应用程序中显示 pdf。但它会退出我的应用程序并在 webbrowser 中显示 pdf。但我想在我的应用程序中显示它并在我的应用程序下方显示后退按钮。那么我怎么能改变这些代码。非常感谢。

 String fullPath = "https://drive.google.com/open?id=0B16f9Z9VbJmCc3RhcnRlcl9maWxl";
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(fullPath));
          startActivity( browserIntent);

【问题讨论】:

    标签: android pdf


    【解决方案1】:

    在您的 webview 中尝试此代码以显示 pdf

    WebView webview = (WebView) findViewById(R.id.webview);
    webview.getSettings().setJavaScriptEnabled(true); 
    String pdf = "your file.pdf";
    webview.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-03
      • 2014-03-04
      • 2012-03-28
      • 1970-01-01
      • 2012-03-27
      • 1970-01-01
      • 1970-01-01
      • 2019-04-30
      相关资源
      最近更新 更多