有没有人在点击 webview 中的超链接时设法调用 pdf 查看器来显示 pdf 文件?如果是这样,您能分享一下您是如何做到这一点的吗?
最佳答案
覆盖 shouldOverrideUrlLoading 以拦截所有 url,当您在 url 中检测到 pdf 文件时,会触发显示 pdf 的 Intent 。
检测 url 是否为 pdf 文件可能需要您下载到可以访问 mime 类型的平台。
然后在外部应用程序中显示 pdf 查看 Reliably detect PDF support on Android device
关于android - 从 webview 中的 pdf 文件的超链接加载 pdf 查看器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3700512/