问题
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