Reputation: 352
I have problem with Android WebView
.
I want to focus input element and show keyboard
on page load without any user actions. Setting input element focus works fine, but keyboard isn't showing. If I make some button in HTML
with same action to set focus then keyboard will appear.
Is this even doable to focus input element in WebView and show keyboard on page load?
Thanks!
Upvotes: 4
Views: 3294
Reputation: 1693
You must force open the keyboard:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
You should also make sure that your WebView has focus and field of content is tagged with:
type="number"
Upvotes: 2