Android prob将在webview中显示pdf
我正在使用android Webview加载url以显示pdf文件。 这是我的密码:Android prob将在webview中显示pdf,android,pdf,webview,google-docs,Android,Pdf,Webview,Google Docs,我正在使用android Webview加载url以显示pdf文件。 这是我的密码: public class TestProgectActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView mtWebView=new WebView(this
public class TestProgectActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView mtWebView=new WebView(this);
setContentView(mtWebView);
mtWebView.getSettings().setJavaScriptEnabled(true);
mtWebView.loadUrl("https://docs.google.com/viewer?url=http://www.cbwe.gov.in/HTMLEditor1/pdf/sample.pdf");
}
}
它正在为链接工作
但这对我们来说是行不通的。当我通过Webview启动此url时,它在Webview中显示HTML内容,而不是实际的pdf文件。这是截图
我的代码有什么问题 试试这个http://docs.google.com/gview?embedded=true&url=http://www.abc.com/xxxxxyyyyyxz.pdfNo 如您所述更改URL。