【发布时间】:2020-08-15 18:14:42
【问题描述】:
我想从 url 加载 pdf,为此我正在使用 PDFViewer 库。但是,打开我的应用程序时它显示为空白。 :( 我需要你的帮助。
这是我的代码:
PDFView pdfView = findViewById(R.id.pdfView);
pdfView.fromUri(Uri.parse("https://firebasestorage.googleapis.com/v0/b/pdff-69823.appspot.com/o/ehp1.pdf?alt=media&token=9bb1792e-0787-461c-a6a8-1be6724be93f")).load();
而且,这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
而且,我正在使用这个依赖:
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
【问题讨论】:
-
方法 fromUri():使用 URI 作为 pdf 源,用于内容提供者
-
@young ,我没听懂。你能解释一下吗?
-
你能解决这个问题吗?如果是的话,您能否分享一下您的答案,因为我也面临同样的问题?
标签: android android-studio pdf