我想从本地PC显示excel文件
但它显示此警报
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = (WebView)findViewById(R.id.webview);
progressbar = (ProgressBar) findViewById(R.id.progressbar);
webview.getSettings().setJavaScriptEnabled(true);
String filename ="http://192.168.18.208:8080/files/6d9fdd50-89a6-11e8-b26a-cd4412cc6d5e-lengkap.xlsx";
webview.loadUrl("https://docs.google.com/gview?embedded=true&url=" + filename);
webview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
progressbar.setVisibility(View.GONE);
}
});
答案 0 :(得分:0)
我遇到了同样的问题,但是我使用以下方法解决了该问题:
String url = null;
try {
url = URLEncoder.encode("YOUR_URL", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
web_view.loadUrl("https://docs.google.com/gview?embedded=true&url=" + url);