AndroidwebVIew打不开添加图片

Viewed 78

webVIew中点击添加图片无反应

3 Answers
        val settings = binding.webView.settings
        settings.javaScriptEnabled = true
        settings.allowFileAccess = true
        settings.allowContentAccess = true
        settings.domStorageEnabled = true
        settings.saveFormData = false
        binding.webView.webChromeClient = WebChromeClient()
        binding.webView.addJavascriptInterface(asForjs, "AndroidHt")

webView.setWebChromeClient(new WebChromeClient(){ @override public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback,
FileChooserParams fileChooserParams) {
//实现文件选择器功能
return true
}
})

IOS能直接打开文件选择器,Android需要手动写吗?代码只有上面那些,对添加图片操作有影响?