在web视图显示Android的.doc文件?视图、文件、web、doc

2023-09-05 01:14:12 作者:总有刁民調戲本宮℡

在我的应用程序,我有链接 http://mymobilece.com/api/api_getexammaterials的.php?ID = 28 , 我想查看的WebView,我与谷歌的文件浏览器试试它的做工精细,但我需要它,而不谷歌文档查看器,如何显示呢??

In my app,I have link http://mymobilece.com/api/api_getexammaterials.php?id=28, I want to view in webview ,I try with google document viewer its work fine But i need it without google document viewer,How to show it??

推荐答案

您可以使用JS的谷歌文档viever

you can use the 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 code(请一定要仔细去除相当,如果高于code)和负载的WebView

you can use myscript as string variable and use this javascript code(please make sure to remove double quite if above code) and load in webview

根据你的脚本宽度 - 高度变量 - 您可以更改URL。 You can change the url - width- height variables according to your scripting.