Disabling 'go' button form submission in Android when using webview

时间秒杀一切 提交于 2020-01-15 11:59:45

问题


I'm developing an Android application and I use a WebView to embed forms into my application. My problem is that android has a soft keyboard and when the user presses 'go' on this keyboard it submits the form. How can I prevent this from happening? I did a power search on google but I did not find any solutions.


回答1:


Ok in the meantime i got a very simple solution: In the manifest XML:

<activity android:name="..."
...
android:imeOptions="actionSend|flagNoEnterAction"
...
</activity>

This way the 'go' button got replaced by 'done' and it hides the keyboard.




回答2:


Create a WebViewClient class and register it with your WebView.

This post discusses this: Android - how to intercept a form POST in android WebViewClient on API level 4



来源:https://stackoverflow.com/questions/5103136/disabling-go-button-form-submission-in-android-when-using-webview

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