We have an app that is using webview to present some HTML pages. This HTML page has input type and we were using input-type = number as we only accept numbers with decimal in this field. So the numeric android keypad appeared with the decimal point.
The problem is the Samsung devices updated to Android 4.3. Now the decimal point is missing from the numeric keyboard.
So we need to put the common keyboard in order to have the decimal point. The problem is that the common keypad appears with letters and we want by default that the keypad appears on the numbers part of the keyboard in order to make more user friendly. Like this.
How can we achieve this??
EDIT: Maybe i haven't explain well. The problem is on a HTML page not in an android TextView So all the android:type answers are not useful.
Subclassing WebView and overriding onCreateInputConnection method does the trick of getting decimal separator into soft keyboard.
Another option is to change HTML input type from "number" to "tel", but that allows user to enter additional characters like "*" and "#".
This seems to be Samsung 4.3 specific issue.
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection connection = super.onCreateInputConnection(outAttrs);
if ((outAttrs.inputType & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER)
{
outAttrs.inputType |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
}
return connection;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With