Android webview file browser opens but file not selectable

被刻印的时光 ゝ 提交于 2020-01-07 02:11:46

问题


HTML Input type file in my android webview was not working for me so I found this solution (File Upload in WebView) and implemented the same, now I am able to open file browser.

But now the problem is I can't select file. Nothing happens on tapping on any file and its shown grayed out as well (like disabled). I've checked on android 5 & 6 both none of them is working for me. Also I have these line in my manifest

<uses-permission 
android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

If someone like to see exact code, I can paste it right here.

Can someone please point out what's wrong with my implementation.


回答1:


After a long research I found that the accept attribute of file HTML tag was doing all this.

My HTML for input type file tag was like this..

<input type="file" name="file1" id="file1" accept="application/zip,image/png,image/jpg,application/msword,application/pdf,image/jpeg,image/gif,vnd.openxmlformats-officedocument.wordprocessingml.document">

And once I removed the content from accept attribute or removed the accept attribute itself, enable the file selection and it resolved my problem.

<input type="file" name="file1" id="file1" accept="">


来源:https://stackoverflow.com/questions/37751033/android-webview-file-browser-opens-but-file-not-selectable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!