gpt4 book ai didi

Android 在 WebView 中显示 .Doc 文件?

转载 作者:行者123 更新时间:2023-11-29 18:15:43 24 4
gpt4 key购买 nike

在我的应用程序中,我有链接 http://mymobilece.com/api/api_getexammaterials.php?id=28 ,我想在 webview 中查看,我尝试使用谷歌文档查看器它工作正常但我需要它没有谷歌文档查看器,如何显示它??

最佳答案

你可以使用 js for google Doc viever

myScript="<html><iframe src='http://docs.google.com/gview?

url='http://mymobilece.com/api/api_getexammaterials.php?

id=28'&embedded='true' style='width:600px; height:500px;'

frameborder='0'></iframe></html>"

mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);

mWebView.loadData(myscript,"text/html", "UTF-8");

你可以使用 myscript 作为字符串变量并使用这个 javascript 代码(如果上面的代码请确保删除 double )并加载到 webview 中

  • 您可以根据脚本更改 url - width-height 变量。

关于Android 在 WebView 中显示 .Doc 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8240294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com