android - 如何在Android中以只读模式显示pdf
问题描述
因为我有 3 个选项可以在 android 中显示 pdf 文件,例如:
1)Webview 2)Action_View 使用 Intent 3)使用这个库 'com.github.barteksc:android-pdf-viewer:2.8.2'
在 Web 视图中,有一些我不需要的默认选项。使用意图在 pdf 查看器或 word 应用程序中显示 pdf 文件,这提供了很多选择。最后一个,图书馆在android x中不起作用。
请提供解决方案,仅在 android 中显示 pdf 而没有任何共享、下载等类型选项。 使用 Webview 的 图像 使用 Intent的图像
解决方案
我正在使用你提到的 androidx 库,我没有任何错误
实现 'com.github.barteksc:android-pdf-viewer:2.8.2'
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".PDFViewActivity">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
推荐阅读
- java - 如何将 JPG 调整为处理图像尺寸(不是压缩)的特定文件大小?
- javascript - 创建 data-url 以将 d3.js 图形下载为 svg 时的空白页面
- vue.js - 当我在没有网络连接的情况下刷新页面时,LocalStorage 不起作用
- unit-testing - 测试 RXJS 自定义管道
- java - 创建一个按钮,即使应用程序处于暂停状态,它也会留在前台
- windows - 在没有 Visual Studio 2017 的 Windows 上构建 Qt WebEngine
- bash - 递归地grep文本文件以过滤绝对路径
- javascript - 三列布局内的可折叠导航
- google-chrome - 如何调整 chrome 窗口的大小以进行 ember 验收测试?
- spring-boot - Spring Boot - 新添加的列导致错误