在我的应用程序Webview网页文件上传,而不是working.but在移动铬浏览器,它工作。对于文件上传选择器的工作,我需要做什么
这里是我的密码
WebView web = findViewById(R.id.webview);
WebSettings websetting = web.getSettings();
websetting.setJavaScriptEnabled(true);
web.loadUrl(web_url);在Chrome浏览器中,我单击显示此选项
这里是图像参考

如何在我的webview中添加此选项
谢谢你的帮助
发布于 2018-06-08 06:33:33
使用这个,//我们为URI中有"google“的URI打开选择器窗口,您可以更改:
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
//If you will not use this method url links are open in new brower not in webview
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// Check if Url contains ExternalLinks string in url
// then open url in new browser
// else all webview links will open in webview browser
if(url.contains("google")){
// Could be cleverer and use a regex
//Open links in new browser
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
// Here we can open new activity
return true;
} else {
// Stay within this webview and load url
view.loadUrl(url);
return true;
}
}
//Show loader on url load
public void onLoadResource (WebView view, String url) {
// if url contains string androidexample
// Then show progress Dialog
if (progressDialog == null && url.contains("androidexample")
) {
// in standard case YourActivity.this
progressDialog = new ProgressDialog(ShowWebView.this);
progressDialog.setMessage("Loading...");
progressDialog.show();
}
}
// Called when all page resources loaded
public void onPageFinished(WebView view, String url) {
try{
// Close progressDialog
if (progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}catch(Exception exception){
exception.printStackTrace();
}
}
});相应地更改操作名称。ACTION_SHARE
https://stackoverflow.com/questions/50754126
复制相似问题