Soft keyboard in web browsing mode - there is no “next” button for tabs between input fields

My soft keyboard does not show this button when I focus the input fields of the web view. You can’t find anything about special settings to enable this - am I missing something? It does not appear in any input field (alpha / number).

Android 4.0.3

Thanks in advance!

+6
source share
3 answers

Here is what helped me (Nexus 4 and Nexus 5 with Android 4.4. *) Using custom WebView and overriding EditInfo from onCreateInputConnection ():

private static class CustomWebView extends WebView { public CustomWebView(Context context) { super(context); } @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { InputConnection inputConnection = super.onCreateInputConnection(outAttrs); if (outAttrs != null) { // remove other IME_ACTION_* outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_GO; outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_SEARCH; outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_SEND; outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_DONE; outAttrs.imeOptions &= ~EditorInfo.IME_ACTION_NONE; // add IME_ACTION_NEXT instead outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } return inputConnection; } } 
+7
source

This is how it was implemented, unfortunately, in Android <4.1

When webkit displays the input fields, it converts them to android.webkit.WebTextView objects, which determine how the on-screen keyboard will look and below 4.1. I don't think there is a way to change this or override the ImeOptions set by the WebTextView class

That’s why, if you have a clean numeric field, you will see the following button, but for other fields you will see the Go button. So the pure figure I would expect to see, surprised that you are not

 <input type="text" name="..." .... /> ----> on the keyboard you see "Go" <input type="number" name="..." .... /> ----> on the keyboard you see "Next" 

This is from webviewclass.java file from webkit

 case WebTextView.NORMAL_TEXT_FIELD: break; case WebTextView.TEXT_AREA: inputType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; action = EditorInfo.IME_ACTION_NONE; break; case WebTextView.PASSWORD: inputType |= EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD; break; case WebTextView.SEARCH: action = EditorInfo.IME_ACTION_SEARCH; break; case WebTextView.EMAIL: // inputType needs to be overwritten because of the different text variation. inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; break; case WebTextView.NUMBER: // inputType needs to be overwritten because of the different class. inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL; // Number and telephone do not have both a Tab key and an // action, so set the action to NEXT break; 

So, it is clear that the number and telephone fields have the following. Now I say <4.1, because 4.1 you could probably use and extend WebViewInputConnection from WebViewClassic.java to webkit and hack it to work in text fields, but yes, there are no changes in Android documents, they stick to this design , and I didn’t even try this, so just a speculative hope: D

+6
source

You can check this link. I wrote javascript code to display the next button next to each input.

-1
source

Source: https://habr.com/ru/post/945550/


All Articles